/* Palette and type from peptidebro.app (style.css, tools.css). */
:root {
  --ink: #0f172a;
  --ink-2: #475569;
  --bg: #fafaf7;
  --card: #ffffff;
  --accent: #4ba3c7;
  --accent-2: #3d5a80;
  --line: #e2e8f0;
  --body: #e8eef3;
  --body-edge: #c7d3dd;
  --last: #f6c945;
  --last-edge: #9a7300;
  --rest: #dff0f7;
  --warn: #b42318;
  --focus: #1474a5;
  --radius: 14px;
  --max: 820px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 20px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; }
a:focus-visible, button:focus-visible, input:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

/* Header */
.top { background: var(--card); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; padding-bottom: 14px; }
.brand { margin: 0; font-weight: 800; font-size: 18px; letter-spacing: -0.01em; }
.brand span { font-weight: 500; color: var(--ink-2); margin-left: 6px; }

main { padding-top: 36px; padding-bottom: 56px; }
h1 { font-size: clamp(28px, 6vw, 40px); line-height: 1.12; letter-spacing: -0.025em; margin: 0 0 12px; }
h2 { font-size: 20px; margin: 0; letter-spacing: -0.01em; }
.lede { color: var(--ink-2); font-size: 18px; margin: 0 0 10px; }
.private { display: inline-block; margin: 4px 0 0; font-size: 14px; color: var(--accent-2); background: #eef3f7; border-radius: 999px; padding: 4px 12px; }
.print-only { display: none; }
.muted, .hint { color: var(--ink-2); font-size: 14px; }

.notice { background: #fff7e6; border: 1px solid #f0c36d; border-radius: var(--radius); padding: 14px 18px; margin: 20px 0 0; }
.notice p { margin: 0 0 10px; }

/* Hero pair: Last used and Longest rest */
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 28px 0 0; }
.pill-card { border-radius: var(--radius); padding: 16px 18px; border: 1px solid var(--line); background: var(--card); }
.pill-card .k { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.pill-card .v { margin: 4px 0 0; font-size: 20px; font-weight: 700; line-height: 1.25; }
.pill-card.last { background: var(--last); border-color: var(--last-edge); }
.pill-card.rest { background: var(--rest); border: 2px dashed var(--accent-2); }

/* Logger */
.logger { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 22px; margin: 20px 0 0; }
.fields { display: grid; grid-template-columns: minmax(0, 200px) minmax(0, 1fr); gap: 14px; }
.fields label { display: block; font-weight: 600; font-size: 14px; }
.fields input { display: block; width: 100%; min-width: 0; margin-top: 6px; padding: 11px 12px; font: inherit; color: var(--ink); background: #fff; border: 1px solid #94a3b8; border-radius: 8px; }
.hint { margin: 10px 0 0; }

.maps { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0 0; }
.maps figure { margin: 0; background: #f6f9fb; border: 1px solid var(--line); border-radius: 12px; padding: 12px 8px 8px; text-align: center; }
.maps svg { width: 100%; max-width: 220px; height: auto; display: block; margin: 0 auto; }
.maps figcaption { font-weight: 700; font-size: 14px; margin-top: 4px; }
.maps figcaption span { font-weight: 400; color: var(--ink-2); }
.figure * { fill: var(--body); stroke: var(--body-edge); stroke-width: 1.5; }
.zone { cursor: pointer; }
.zone rect { fill: #fff; stroke: var(--accent-2); stroke-width: 1.5; transition: fill 0.15s; }
.zone text { font: 700 14px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; fill: var(--accent-2); pointer-events: none; }
.zone:hover rect { fill: #eef6fa; }
.zone.is-new rect { stroke-dasharray: 3 3; }
.zone.is-rest rect { fill: var(--rest); stroke-width: 3; stroke-dasharray: 6 3; }
.zone.is-last rect { fill: var(--last); stroke: var(--last-edge); stroke-width: 3; stroke-dasharray: none; }
.zone.is-last text { fill: var(--ink); }

.disclaimer { margin: 14px 0 0; font-size: 13px; color: var(--ink-2); border-left: 3px solid var(--accent); padding: 2px 0 2px 10px; }

.areas { list-style: none; padding: 0; margin: 18px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.areas button { width: 100%; min-height: 64px; display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; text-align: left; padding: 10px 12px; font: inherit; color: var(--ink); background: #fff; border: 1px solid #cbd5e1; border-radius: 10px; cursor: pointer; }
.areas button:hover { border-color: var(--accent-2); }
.areas .name { font-weight: 700; }
.areas .side { font-size: 12px; color: var(--ink-2); align-self: center; }
.areas .state { grid-column: 1 / -1; font-size: 13px; color: var(--ink-2); }
.areas .is-last { background: var(--last); border: 2px solid var(--last-edge); }
.areas .is-last .state, .areas .is-last .side { color: var(--ink); font-weight: 600; }
.areas .is-rest { background: var(--rest); border: 2px dashed var(--accent-2); }
.areas .is-rest .state { color: var(--accent-2); font-weight: 600; }
.live { min-height: 1.6em; margin: 12px 0 6px; font-weight: 600; color: var(--accent-2); }

button { font: inherit; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.ghost { padding: 9px 14px; border-radius: 8px; border: 1px solid #94a3b8; background: #fff; color: var(--ink); cursor: pointer; }
.ghost:hover:not(:disabled) { border-color: var(--ink); }
.warn { color: var(--warn); }
button.warn:not(.ghost) { background: var(--warn); color: #fff; border: 0; border-radius: 8px; padding: 10px 14px; cursor: pointer; }
.link { background: none; border: 0; padding: 4px 2px; color: var(--warn); text-decoration: underline; cursor: pointer; }

/* History */
.history { margin: 36px 0 0; }
.row-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; }
table { width: 100%; border-collapse: collapse; margin: 16px 0 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 15px; vertical-align: top; }
thead th { font-size: 13px; color: var(--ink-2); font-weight: 600; background: #f6f9fb; }
td.label { overflow-wrap: anywhere; white-space: pre-wrap; }
td.act { text-align: right; width: 1%; }

.cta { margin: 28px 0 0; padding: 20px; background: var(--ink); color: #fff; border-radius: var(--radius); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; }
.cta p { margin: 0; font-size: 17px; font-weight: 600; max-width: 440px; }
.store { display: inline-block; padding: 12px 18px; background: #fff; color: var(--ink); border-radius: 10px; text-decoration: none; font-weight: 700; }
.cta .store:focus-visible { outline-color: #fff; }

.danger { margin: 28px 0 0; }
.confirm { margin: 12px 0 0; padding: 14px 16px; border: 1px solid #f3b4ae; background: #fff5f4; border-radius: 12px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.confirm p { margin: 0; flex-basis: 100%; }

footer { border-top: 1px solid var(--line); padding-top: 18px; padding-bottom: 32px; color: var(--ink-2); font-size: 13px; }
footer p { margin: 0 0 4px; }

@media (max-width: 600px) {
  .logger { padding: 16px; }
  .fields { grid-template-columns: 1fr; }
  .pill-card .v { font-size: 17px; }
  .maps figure { padding: 8px 4px 6px; }
}
@media (max-width: 380px) {
  .pair { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .zone rect { transition: none; } }

/* Printable rotation sheet: summary, area statuses, map and history; no controls. */
@media print {
  @page { margin: 14mm; }
  body { background: #fff; font-size: 11pt; }
  .top, .skip, .lede, .private, .notice, .fields, .hint, .live, #undo, .tools, .cta, .danger, td.act, th:last-child { display: none !important; }
  main { padding: 0; }
  h1 { font-size: 20pt; }
  .intro h1 { display: none; }
  .print-only { display: block !important; font-size: 18pt; font-weight: 800; margin: 0 0 8px; }
  .logger { border: 0; padding: 0; }
  .maps svg { max-width: 150px; }
  .pill-card, .areas button, .zone rect { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .areas { grid-template-columns: repeat(4, 1fr); }
  .areas button { min-height: 0; }
  table { border: 1px solid #94a3b8; }
  tr { break-inside: avoid; }
}

footer a { color: inherit; }
@media print { [data-site-links] { display: none !important; } }
.brand a { color: inherit; text-decoration: none; }
.brand a[href]:hover, .brand a[href]:focus-visible { text-decoration: underline; }
