:root {
      --bg: #f3efe6;
      --bg-deep: #e7e0d2;
      --ink: #1c2430;
      --muted: #5c6675;
      --line: #cfc6b6;
      --panel: rgba(255, 252, 246, 0.92);
      --accent: #0f766e;
      --accent-soft: #d7efe9;
      --warn: #b45309;
      --warn-soft: #fde8c8;
      --ok: #047857;
      --shadow: 0 18px 50px rgba(28, 36, 48, 0.08);
      --radius: 18px;
    }

    * { box-sizing: border-box; }
    html, body { margin: 0; min-height: 100%; }
    body {
      font-family: "Sora", sans-serif;
      color: var(--ink);
      background:
        radial-gradient(900px 420px at 8% -10%, #d9f3ee 0%, transparent 55%),
        radial-gradient(700px 360px at 100% 0%, #f8e7c8 0%, transparent 50%),
        linear-gradient(180deg, var(--bg) 0%, #ebe4d7 100%);
    }

    .wrap {
      width: min(1120px, calc(100% - 32px));
      margin: 0 auto;
      padding: 28px 0 48px;
    }

    header {
      display: grid;
      gap: 10px;
      margin-bottom: 22px;
    }

    header .eyebrow {
      color: var(--accent);
      font-size: 12px;
      font-weight: 600;
      letter-spacing: 0.08em;
      text-transform: uppercase;
    }

    h1 {
      margin: 0;
      font-size: clamp(1.6rem, 3vw, 2.2rem);
      letter-spacing: -0.03em;
    }

    header p {
      margin: 0;
      color: var(--muted);
      max-width: 54ch;
      line-height: 1.55;
    }

    .layout {
      display: grid;
      grid-template-columns: 1.4fr 0.9fr;
      gap: 18px;
      align-items: start;
    }

    @media (max-width: 900px) {
      .layout { grid-template-columns: 1fr; }
      .summary { position: static !important; }
    }

    .panel {
      background: var(--panel);
      border: 1px solid var(--line);
      border-radius: var(--radius);
      box-shadow: var(--shadow);
      overflow: hidden;
    }

    .panel-head {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 12px;
      padding: 16px 18px;
      border-bottom: 1px solid var(--line);
      background: linear-gradient(180deg, #fffdf8, #f7f1e6);
    }

    .panel-head h2 {
      margin: 0;
      font-size: 1rem;
      font-weight: 600;
    }

    .panel-head .hint {
      color: var(--muted);
      font-size: 12px;
    }

    .toolbar {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      padding: 12px 18px;
      border-bottom: 1px solid var(--line);
      background: rgba(255,255,255,0.45);
    }

    button {
      font: inherit;
      cursor: pointer;
      border: 1px solid var(--line);
      background: #fff;
      color: var(--ink);
      border-radius: 999px;
      padding: 7px 12px;
      font-size: 12px;
      font-weight: 600;
      transition: 0.15s ease;
    }

    button:hover { border-color: var(--accent); color: var(--accent); }
    button.ghost { background: transparent; }

    .section-title {
      padding: 14px 18px 6px;
      font-size: 12px;
      font-weight: 700;
      color: var(--muted);
      letter-spacing: 0.04em;
      text-transform: uppercase;
    }

    .row {
      display: grid;
      grid-template-columns: 28px minmax(0, 1fr) auto auto;
      gap: 12px;
      align-items: center;
      padding: 12px 18px;
      border-top: 1px solid rgba(207, 198, 182, 0.55);
    }

    .row:hover { background: rgba(15, 118, 110, 0.04); }

    .row.is-off .name,
    .row.is-off .meta {
      opacity: 0.42;
    }

    .name {
      display: grid;
      gap: 2px;
      min-width: 0;
    }

    .name strong {
      font-size: 14px;
      font-weight: 600;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .name span {
      color: var(--muted);
      font-size: 12px;
      font-family: "IBM Plex Mono", monospace;
    }

    .meta {
      text-align: right;
      font-family: "IBM Plex Mono", monospace;
      font-size: 12px;
      color: var(--muted);
      white-space: nowrap;
    }

    .meta b {
      display: block;
      color: var(--ink);
      font-size: 13px;
      font-weight: 600;
    }

    input[type="checkbox"] {
      width: 18px;
      height: 18px;
      accent-color: var(--accent);
      cursor: pointer;
    }

    .ticket-input {
      width: 96px;
      height: 34px;
      border: 1px solid var(--line);
      border-radius: 10px;
      background: #fff;
      padding: 0 10px;
      font-family: "IBM Plex Mono", monospace;
      font-size: 13px;
      font-weight: 600;
      color: var(--ink);
      text-align: right;
    }

    .ticket-input:focus {
      outline: 2px solid rgba(15, 118, 110, 0.25);
      border-color: var(--accent);
    }

    .hint-cap {
      color: var(--warn);
      font-weight: 700;
    }

    .row.ssr-row {
      grid-template-columns: 28px minmax(0, 1fr) auto auto;
    }

    .stepper {
      display: inline-flex;
      align-items: center;
      gap: 0;
      border: 1px solid var(--line);
      border-radius: 999px;
      overflow: hidden;
      background: #fff;
    }

    .stepper button {
      border: 0;
      border-radius: 0;
      width: 32px;
      height: 32px;
      padding: 0;
      font-size: 16px;
      line-height: 1;
    }

    .stepper button:disabled {
      opacity: 0.35;
      cursor: not-allowed;
    }

    .stepper .count {
      min-width: 34px;
      text-align: center;
      font-family: "IBM Plex Mono", monospace;
      font-weight: 600;
      font-size: 13px;
    }

    .summary {
      position: sticky;
      top: 16px;
      display: grid;
      gap: 14px;
    }

    .stats {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
      padding: 18px;
    }

    .stat {
      padding: 14px;
      border-radius: 14px;
      background: var(--bg-deep);
      border: 1px solid var(--line);
    }

    .stat.wide { grid-column: 1 / -1; background: var(--accent-soft); border-color: #b7ddd4; }
    .stat label {
      display: block;
      font-size: 12px;
      color: var(--muted);
      margin-bottom: 6px;
    }
    .stat strong {
      font-family: "IBM Plex Mono", monospace;
      font-size: 1.45rem;
      letter-spacing: -0.03em;
    }

    .milestones {
      padding: 0 18px 18px;
      display: grid;
      gap: 8px;
    }

    .milestone {
      display: flex;
      justify-content: space-between;
      gap: 12px;
      align-items: center;
      padding: 12px 14px;
      border-radius: 12px;
      border: 1px solid var(--line);
      background: #fff;
    }

    .milestone.hit {
      background: var(--warn-soft);
      border-color: #efc48a;
    }

    .milestone .left {
      display: grid;
      gap: 2px;
    }

    .milestone .left strong { font-size: 14px; }
    .milestone .left span {
      font-size: 12px;
      color: var(--muted);
      font-family: "IBM Plex Mono", monospace;
    }

    .badge {
      font-size: 11px;
      font-weight: 700;
      padding: 5px 9px;
      border-radius: 999px;
      background: var(--bg-deep);
      color: var(--muted);
      white-space: nowrap;
    }

    .milestone.hit .badge {
      background: #f59e0b;
      color: #1c1408;
    }

    .gap-note {
      margin: 0 18px 18px;
      padding: 12px 14px;
      border-radius: 12px;
      background: #fff;
      border: 1px dashed var(--line);
      color: var(--muted);
      font-size: 13px;
      line-height: 1.5;
    }

    .gap-note b {
      color: var(--ink);
      font-family: "IBM Plex Mono", monospace;
    }

    footer.note {
      margin-top: 16px;
      color: var(--muted);
      font-size: 12px;
      line-height: 1.5;
    }

    .ref-table {
      width: 100%;
      border-collapse: collapse;
      font-size: 12px;
      table-layout: fixed;
    }

    .ref-table th,
    .ref-table td {
      padding: 8px 10px;
      text-align: left;
      border-top: 1px solid rgba(207, 198, 182, 0.55);
      vertical-align: middle;
    }

    .ref-table th {
      font-size: 11px;
      color: var(--muted);
      font-weight: 600;
      background: rgba(255,255,255,0.35);
    }

    .ref-table .lv {
      font-family: "IBM Plex Mono", monospace;
      font-weight: 600;
      width: 12%;
      white-space: nowrap;
    }

    .ref-table .reward {
      width: 38%;
    }

    .ref-table .split {
      border-left: 1px solid rgba(207, 198, 182, 0.75);
    }

    .ref-table .unknown {
      color: var(--muted);
      font-weight: 700;
    }

    .ref-table tr:hover td {
      background: rgba(15, 118, 110, 0.04);
    }

    .ref-foot {
      padding: 10px 14px 12px;
      color: var(--muted);
      font-size: 11px;
      border-top: 1px solid rgba(207, 198, 182, 0.55);
    }

    code {
      font-family: "IBM Plex Mono", monospace;
      font-size: 11px;
      background: rgba(255,255,255,0.7);
      padding: 1px 5px;
      border-radius: 4px;
    }


/* Touch-friendly layouts and a persistent mobile total. */
.save-status { color: var(--muted); font-size: 12px; margin: -8px 0 18px; }
.name { cursor: pointer; }
.mobile-summary { display: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.layout > *, .summary, .meta { min-width: 0; }
@media (max-width: 600px) {
  .wrap { width: calc(100% - 24px); padding: 22px 0 calc(100px + env(safe-area-inset-bottom)); }
  header { gap: 8px; margin-bottom: 18px; }
  header p { font-size: 14px; }
  .panel { border-radius: 16px; }
  .panel-head { padding: 14px; flex-wrap: wrap; gap: 6px 12px; }
  .toolbar { display: grid; grid-template-columns: 1fr 1fr; padding: 12px; }
  .toolbar button { min-height: 44px; font-size: 13px; }
  .row, .row.ssr-row {
    grid-template-columns: 32px minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px 10px; padding: 14px 12px;
  }
  .row > input[type="checkbox"] { grid-column: 1; grid-row: 1 / 3; width: 24px; height: 24px; margin: 0; align-self: stretch; min-height: 44px; }
  .row .name { grid-column: 2 / 4; grid-row: 1; min-height: 44px; align-content: center; }
  .name strong { white-space: normal; overflow: visible; font-size: 15px; }
  .name span { line-height: 1.5; }
  .row > .meta { grid-column: 2; grid-row: 2; text-align: left; white-space: normal; overflow-wrap: anywhere; line-height: 1.6; }
  .row > :last-child { grid-column: 3; grid-row: 2; justify-self: end; }
  .row > .meta:last-child { text-align: right; }
  .ticket-input { width: 100%; max-width: 150px; height: 46px; font-size: 16px; }
  .stepper { max-width: 100%; }
  .stepper button { width: 44px; height: 44px; flex-shrink: 0; font-size: 22px; touch-action: manipulation; }
  .stepper .count { min-width: 28px; font-size: 15px; }
  .row.is-off .name, .row.is-off .meta { opacity: .65; }
  .stats { padding: 14px; }
  .ref-table th, .ref-table td { padding: 10px 6px; overflow-wrap: anywhere; }
  .ref-table .lv { width: 15%; }
  .ref-table .reward { width: 35%; }
  #summary { scroll-margin-top: 12px; }
  .mobile-summary {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    position: fixed; z-index: 10; left: 0; right: 0; bottom: 0;
    padding: 14px max(14px, env(safe-area-inset-right)) calc(14px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
    background: #fffdf8; border-top: 1px solid var(--line); box-shadow: 0 -4px 24px #1c243014;
    color: var(--ink); text-decoration: none; font-size: 14px; min-height: 64px;
  }
  .mobile-summary strong { color: var(--accent); font-size: 22px; }
  .mobile-details { color: var(--accent); font-size: 12px; }
}
