  :root {
    --bg: #ffffff;
    --ink: #222;
    --muted: #707070;
    --line: #d0d0d0;
    --line-strong: #8a8a8a;
    --correct: #2f8f3b;
    --warm: #b06a1f;
    --cool: #2a5aa3;
  }
  * { box-sizing: border-box; }
  html, body {
    margin: 0; padding: 0;
    background: var(--bg); color: var(--ink);
    overflow-x: hidden; max-width: 100vw;
  }
  img { max-width: 100%; }
  body {
    font-family: "Lucida Grande", "Lucida Sans Unicode", "Segoe UI", Tahoma, sans-serif;
    font-size: 13px;
    width: 100%; max-width: 100vw;
    height: 100vh; height: 100dvh;
    display: flex; flex-direction: column; align-items: center;
    padding: clamp(10px, 3vw, 24px);
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
  }

  header {
    width: 100%; max-width: 640px; min-width: 0;
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: clamp(8px, 2vw, 14px);
    flex-shrink: 0;
  }
  header .mark { display: flex; align-items: center; }
  header .mark img { height: clamp(22px, 4vw, 32px); width: auto; display: block; }
  header .right { display: flex; align-items: center; gap: 14px; }
.picker { position: relative; }
  .picker .caret { margin-left: 3px; font-size: 9px; opacity: 0.7; }
  .picker-menu {
    position: absolute; top: calc(100% + 4px); right: 0;
    background: #fff;
    border: 1px solid #7a7a7a; border-radius: 6px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.25), 0 1px 0 rgba(255,255,255,0.8) inset;
    padding: 4px 0; min-width: 170px;
    display: none; z-index: 100;
  }
  .picker.open .picker-menu { display: block; }
  .picker-item {
    display: block; width: 100%; text-align: left;
    padding: 5px 14px; font-size: 12px;
    background: none; border: none; cursor: pointer;
    color: var(--ink);
    font-family: inherit;
  }
  .picker-item:hover { background: linear-gradient(to bottom, #4a86d0 0%, #2a62b0 100%); color: #fff; }
  .picker-item.active { font-weight: 700; }
  .picker-item.active::before { content: "✓ "; margin-left: -10px; }

  main {
    width: 100%; max-width: 640px; min-width: 0; flex: 1;
    display: flex; flex-direction: column; min-height: 0;
    gap: clamp(8px, 2vw, 14px);
  }

  #card { flex: 1; display: flex; flex-direction: column; min-height: 0; gap: clamp(8px, 2vw, 12px); }

  .skeleton, .errorbox { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 13px; }
  .errorbox { color: #a81f12; }

  .gallery {
    flex: 1; min-height: 0; min-width: 0;
    display: flex; gap: 10px;
    align-items: stretch;
  }
  .thumbs {
    display: flex; flex-direction: column; gap: 6px;
    overflow-y: auto; overflow-x: hidden;
    width: 56px; flex-shrink: 0;
    padding-right: 2px;
    scrollbar-width: thin;
  }
  .thumbs::-webkit-scrollbar { width: 6px; height: 6px; }
  .thumbs::-webkit-scrollbar-thumb { background: #cfcfcf; border-radius: 3px; }
  .thumbs .thumb {
    width: 52px; height: 52px;
    border: 1px solid var(--line); border-radius: 8px;
    overflow: hidden; flex-shrink: 0; cursor: pointer;
    background: #fff; padding: 0;
    transition: border-color 0.1s, box-shadow 0.1s;
  }
  .thumbs .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .thumbs .thumb:hover { border-color: #888; }
  .thumbs .thumb.active {
    border: 2px solid var(--ink);
    box-shadow: 0 0 0 1px #fff inset;
  }
  .imgwrap {
    flex: 1; min-height: 0; min-width: 0;
    position: relative;
    display: flex; align-items: center; justify-content: center; overflow: hidden;
    cursor: zoom-in;
  }
  .imgwrap img {
    width: 100%; height: 100%; object-fit: contain;
    transition: transform 0.06s ease-out;
    transform-origin: var(--ox, 50%) var(--oy, 50%);
    will-change: transform;
  }
  .imgwrap.zooming { cursor: crosshair; }
  .imgwrap.zooming img { transform: scale(2.6); transition: transform 0.12s ease-out; }
  @media (hover: none) {
    .imgwrap { cursor: default; }
    .imgwrap.zooming img { transform: none; }
  }

  /* On narrow viewports, put thumbs below image as a horizontal strip */
  @media (max-width: 560px) {
    .gallery { flex-direction: column; gap: 6px; }
    .thumbs {
      flex-direction: row; width: 100%; height: auto;
      overflow-x: auto; overflow-y: hidden;
      padding: 0 0 2px 0;
      flex-shrink: 0;
    }
    .thumbs .thumb { width: 42px; height: 42px; }
  }

  .info { flex-shrink: 0; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
  .info .cat {
    font-size: clamp(9px, 2vw, 10px); color: var(--muted); letter-spacing: 0.08em;
    text-transform: uppercase;
  }
  .info .title {
    font-size: clamp(14px, 3.2vw, 16px); font-weight: 700; line-height: 1.1;
    margin: 0; letter-spacing: -0.01em;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    word-break: break-word;
  }
  .rows { display: flex; flex-direction: column; gap: 5px; flex-shrink: 0; }
  .row {
    display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: clamp(8px, 2vw, 12px);
    align-items: center;
    border: 1px solid var(--line);
    padding: clamp(6px, 1.5vw, 8px) clamp(10px, 3vw, 14px);
    font-variant-numeric: tabular-nums;
    background: #fff;
    min-width: 0;
  }
  .row.empty { border-style: dashed; }
  .row.empty .val { color: var(--line); font-weight: 400; }
  .row.filled { border-color: var(--line-strong); border-width: 1.5px; }
  .row .n { font-size: 11px; color: var(--muted); font-weight: 600; }
  .row .val { font-size: clamp(13px, 3vw, 15px); font-weight: 700; }
  .hint-group { display: flex; align-items: center; gap: 8px; }
  .arrow-placeholder { width: 26px; height: 32px; }

  .credit-bar {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 20px 0 10px;
    flex-shrink: 0;
  }
  .credit-row {
    display: flex; flex-direction: row; align-items: center; gap: 6px;
  }
  .credit {
    font-size: 11px; color: var(--muted);
    text-decoration: none; white-space: nowrap;
  }
  .credit-turtle { width: 48px; height: auto; display: block; }
  .credit:hover { color: var(--ink); }
  .credit b { color: var(--ink); font-weight: 600; }
  .credit-about {
    background: none; border: none; padding: 0; margin: 0;
    font-size: 11px; color: var(--muted); font-family: inherit;
    cursor: pointer;
  }
  .credit-about:hover { color: var(--ink); }
  .credit-dot { font-size: 11px; color: var(--muted); }
  .hint-text {
    font-size: clamp(10px, 2vw, 11px); font-weight: 700;
    letter-spacing: 0.06em; text-transform: uppercase;
    white-space: nowrap;
  }
  .hint-text.too-high { color: #b8281e; }
  .hint-text.too-low { color: #2e8d3e; }
  .hint-text.correct { color: #2e8d3e; }
  .hint-text[data-heat="hot"]       { color: #c7281a; }  /* Hot — bright red */
  .hint-text[data-heat="warmer"]    { color: #d65a2c; }  /* Warmer — orange-red */
  .hint-text[data-heat="warm"]      { color: #cc8b2a; }  /* Warm — amber */
  .hint-text[data-heat="colder"]    { color: #5e93bf; }  /* Colder — light blue */
  .hint-text[data-heat="cold"]      { color: #3c7bb0; }  /* Cold — steel blue */
  .hint-text[data-heat="supercold"] { color: #1f3f7a; }  /* Super cold — deep blue */

  .arrow {
    width: 26px; height: 32px;
    display: inline-block;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.35));
    flex-shrink: 0;
  }
  .arrow svg { width: 100%; height: 100%; display: block; }

  .form { display: flex; gap: 8px; align-items: stretch; flex-shrink: 0; flex-wrap: wrap; }
  .form > .input-wrap { min-width: 0; flex: 1 1 180px; }

  /* Aqua-style bezeled input */
  .input-wrap {
    flex: 1; display: flex; align-items: center;
    background: #fff;
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    padding: 0 14px;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.12);
  }
  .input-wrap .cur { font-weight: 700; font-size: 13px; color: #555; margin-right: 6px; }
  .input-wrap input {
    flex: 1; border: none; outline: none; background: transparent;
    font-family: inherit; font-size: 13px; font-weight: 600;
    padding: 8px 0; color: var(--ink);
    font-variant-numeric: tabular-nums;
  }
  .input-wrap input::placeholder { color: #9a9a9a; font-weight: 400; }
  .input-wrap input::-webkit-outer-spin-button,
  .input-wrap input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

  /* Aqua gel primary button */
  .aqua-btn {
    font-family: inherit; font-size: 13px; font-weight: 700; color: #fff;
    background:
      linear-gradient(to bottom,
        rgba(255,255,255,0.9) 0%,
        rgba(255,255,255,0.15) 50%,
        rgba(255,255,255,0.0) 50%,
        rgba(255,255,255,0.22) 100%),
      linear-gradient(to bottom, #8fb9ef 0%, #4a86d0 50%, #2a62b0 51%, #447fc7 100%);
    border: 1px solid #1c4a8a;
    border-radius: 14px;
    padding: 4px 22px;
    cursor: pointer;
    box-shadow: 0 1px 0 rgba(255,255,255,0.4) inset, 0 1px 2px rgba(0,0,0,0.22);
    text-shadow: 0 -1px 0 rgba(0,0,0,0.25);
    min-height: 34px;
    flex-shrink: 0;
  }
  .aqua-btn:hover:not(:disabled) { filter: brightness(1.05); }
  .aqua-btn:active:not(:disabled) {
    background:
      linear-gradient(to bottom, #2a62b0 0%, #447fc7 50%, #4a86d0 51%, #8fb9ef 100%);
  }
  .aqua-btn:disabled { opacity: 0.5; cursor: not-allowed; }

  /* Grey push button */
  .push-btn {
    font-family: inherit; font-size: 12px; font-weight: 400; color: #000;
    background: linear-gradient(to bottom, #fefefe 0%, #d6d6d6 100%);
    border: 1px solid #7a7a7a;
    border-radius: 12px;
    padding: 3px 14px;
    cursor: pointer;
    box-shadow: 0 1px 0 rgba(255,255,255,0.8) inset, 0 1px 1px rgba(0,0,0,0.1);
    text-shadow: 0 1px 0 rgba(255,255,255,0.9);
    min-height: 26px;
  }
  .push-btn:hover { filter: brightness(1.02); }
  .push-btn:active { background: linear-gradient(to bottom, #bfbfbf 0%, #e4e4e4 100%); }

  /* Modal popup */
  .modal-overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(0,0,0,0.45);
    display: none; align-items: center; justify-content: center;
    padding: 20px;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    animation: fadeIn 0.18s ease-out;
  }
  .modal-overlay.open { display: flex; }
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
  @keyframes popIn {
    from { transform: scale(0.94) translateY(10px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
  }
  .modal {
    width: 100%; max-width: 400px;
    background: #fff;
    border: 1px solid #5a5a5a;
    border-radius: 10px;
    box-shadow:
      0 1px 0 rgba(255,255,255,0.7) inset,
      0 24px 60px rgba(0,0,0,0.45),
      0 2px 8px rgba(0,0,0,0.3);
    overflow: hidden;
    animation: popIn 0.22s cubic-bezier(0.2, 0.8, 0.3, 1.1);
  }
  .modal-head {
    background:
      repeating-linear-gradient(to bottom,
        rgba(0,0,0,0.03) 0px, rgba(0,0,0,0.03) 1px,
        rgba(255,255,255,0) 1px, rgba(255,255,255,0) 2px),
      linear-gradient(to bottom, #efefef 0%, #cdcdcd 100%);
    border-bottom: 1px solid #7a7a7a;
    padding: 8px 12px;
    display: flex; align-items: center; justify-content: center;
    position: relative;
    min-height: 24px;
  }
  .modal-head .title {
    font-size: 13px; font-weight: 700; color: #3a3a3a;
    text-shadow: 0 1px 0 rgba(255,255,255,0.8);
  }
  .modal-head .close {
    position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
    width: 14px; height: 14px; border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #ff9b97 0%, #ff5f56 55%, #d63a31 100%);
    border: 1px solid rgba(0,0,0,0.35);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
    cursor: pointer; padding: 0;
  }
  .modal-body { padding: 22px 22px 18px; text-align: center; }
  .modal-headline {
    font-size: 24px; font-weight: 700; letter-spacing: -0.01em;
    margin: 0 0 6px;
  }
  .modal-headline.win { color: var(--correct); }
  .modal-headline.lose { color: #a81f12; }
  .modal-subline { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
  .modal-image {
    width: 120px; height: 120px; margin: 0 auto 14px;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
  }
  .modal-image img { max-width: 100%; max-height: 100%; object-fit: contain; }
  .modal-stats {
    display: grid; grid-template-columns: 1fr auto; gap: 8px 16px;
    padding: 12px 14px; margin: 0 0 16px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fafafa;
    text-align: left;
    font-variant-numeric: tabular-nums;
  }
  .modal-stats dt { font-size: 12px; color: var(--muted); margin: 0; }
  .modal-stats dd { font-size: 13px; font-weight: 700; margin: 0; text-align: right; }
  .modal-stats dd.big { font-size: 15px; }
  .card-community {
    display: flex; align-items: center; justify-content: center;
    gap: 6px; flex-wrap: wrap;
    padding: 8px 14px;
    margin: 0 0 6px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fafafa;
    font-size: 12px; color: var(--muted);
    text-align: center;
  }
  .card-community strong { color: var(--ink); }
  .card-community--loading { color: var(--muted); font-style: italic; }
  .cc-sep { color: var(--line-strong); }
  .modal-community {
    display: flex; align-items: center; gap: 0;
    margin: 0 0 16px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fafafa;
    overflow: hidden;
  }
  .mc-stat {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    gap: 3px; padding: 12px 10px;
  }
  .mc-val {
    font-size: 22px; font-weight: 800; line-height: 1;
    font-variant-numeric: tabular-nums; color: var(--ink);
  }
  .mc-label { font-size: 11px; color: var(--muted); text-align: center; }
  .mc-divider { width: 1px; align-self: stretch; background: var(--line); flex-shrink: 0; }
  .modal-actions { display: flex; gap: 10px; justify-content: center; align-items: center; flex-wrap: wrap; }
  .ebay-btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 4px 12px;
    background: linear-gradient(to bottom, #fefefe 0%, #dcdcdc 100%);
    border: 1px solid #9a9a9a;
    border-radius: 14px;
    box-shadow:
      0 1px 0 rgba(255,255,255,0.85) inset,
      0 1px 2px rgba(0,0,0,0.15);
    text-decoration: none;
    color: #222;
    font-size: 12px; font-weight: 700;
    text-shadow: 0 1px 0 rgba(255,255,255,0.8);
    cursor: pointer;
    transition: filter 0.1s;
  }
  .ebay-btn:hover { filter: brightness(1.03); }
  .ebay-btn:active { background: linear-gradient(to bottom, #c6c6c6 0%, #e6e6e6 100%); }
  .ebay-btn img { height: 14px; width: auto; display: block; }

  .modal-actions .push-btn { min-height: 26px; font-size: 12px; padding: 3px 12px; }

  .toast {
    position: fixed;
    left: 50%; top: 50%;
    transform: translate(-50%, -50%) scale(0.94);
    background: rgba(28, 28, 30, 0.94);
    color: #fff;
    padding: 22px 32px;
    border-radius: 0;
    font-size: 16px; font-weight: 600;
    letter-spacing: 0.01em;
    box-shadow: 0 12px 40px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.08) inset;
    opacity: 0; pointer-events: none;
    transition: opacity 0.18s, transform 0.18s;
    z-index: 10001;
    display: flex; align-items: center; gap: 12px;
    min-width: 160px; justify-content: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
  .toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  .toast .check {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: #2f8f3b;
    font-size: 13px; font-weight: 800;
    color: #fff;
  }

  .modal-actions .aqua-btn {
    font-size: 12px; padding: 3px 14px; min-height: 26px;
    border-radius: 12px;
  }
  .modal-title-ellipsis {
    font-size: 13px; color: var(--ink); font-weight: 600;
    margin: 0 0 12px; line-height: 1.3;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  }

  .intro-body { padding: 22px 22px 18px; text-align: left; }
  .intro-logo { text-align: center; margin-bottom: 10px; }
  .intro-logo img { height: 32px; width: auto; }
  .intro-title {
    text-align: center; font-size: 18px; font-weight: 700; margin: 0 0 14px;
    letter-spacing: -0.01em;
  }
  .intro-lead {
    text-align: center; color: var(--ink); font-size: 14px;
    font-weight: 600;
    margin: 0 0 16px; line-height: 1.4;
  }
  .intro-steps {
    list-style: none; padding: 0; margin: 0 0 18px;
    display: flex; flex-direction: column; gap: 10px;
  }
  .intro-steps li {
    display: grid; grid-template-columns: 24px 1fr; gap: 12px; align-items: start;
    font-size: 13px; line-height: 1.45;
  }
  .intro-steps .step-n {
    width: 22px; height: 22px; border-radius: 50%;
    background: linear-gradient(to bottom, #fefefe 0%, #d0d0d0 100%);
    border: 1px solid #7a7a7a;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700;
    box-shadow: 0 1px 0 rgba(255,255,255,0.8) inset;
    text-shadow: 0 1px 0 rgba(255,255,255,0.8);
  }
  .intro-steps .mini-arrow {
    display: inline-block; width: 14px; height: 18px; vertical-align: -4px;
    margin: 0 1px;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.25));
  }
  .intro-steps .mini-arrow svg { width: 100%; height: 100%; display: block; }
  .intro-actions { display: flex; justify-content: center; }

  footer {
    margin-top: clamp(10px, 2vw, 14px);
    display: flex; gap: 10px; justify-content: center;
    flex-shrink: 0; flex-wrap: wrap;
  }

  /* Narrow viewports: compact everything so it still fits without scrolling */
  @media (max-width: 560px) {
    header { margin-bottom: 6px; }
    main { gap: 8px; }
    #card { gap: 6px; }
    .info .title { -webkit-line-clamp: 1; font-size: 13px; }
    .info { gap: 1px; }
    .rows { gap: 4px; }
    .row { padding: 5px 10px; }
    .row .val { font-size: 13px; }
    .arrow, .arrow-placeholder { width: 22px; height: 26px; }
    .input-wrap { padding: 0 12px; }
    .input-wrap input { padding: 8px 0; font-size: 14px; }
    .aqua-btn { padding: 3px 14px; min-height: 28px; font-size: 12px; }
    .credit { font-size: 10px; }
    .credit-turtle { display: none; }
  }

  /* Very short viewports (landscape phones): trim further */
  @media (max-height: 560px) {
    header { margin-bottom: 4px; }
    .imgwrap { min-height: 80px; }
    .row { padding: 4px 10px; }
    .info .title { -webkit-line-clamp: 1; }
    .info .cat { display: none; }
  }

  /* Ultra-wide: keep the layout readable, don't stretch */
  @media (min-width: 1200px) {
    main, header { max-width: 680px; }
  }

  /* Cart / session history — raw image, no button chrome */
  .cart-btn {
    position: relative;
    flex-shrink: 0;
    width: auto; height: auto;
    padding: 0; margin: 0;
    background: none;
    border: none;
    cursor: pointer;
    display: inline-flex; align-items: center;
    transition: transform 0.1s, opacity 0.1s;
  }
  .cart-btn:hover { opacity: 0.8; transform: translateY(-1px); }
  .cart-btn:active { transform: translateY(0); }
  .cart-btn img {
    width: clamp(40px, 6vw, 54px);
    height: auto;
    object-fit: contain; display: block;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.35));
  }
  .cart-count {
    position: absolute; top: -5px; right: -5px;
    min-width: 16px; height: 16px; padding: 0 3px;
    background: #e03020; color: #fff;
    font-size: 10px; font-weight: 700;
    border-radius: 8px;
    border: 1px solid #fff;
    pointer-events: none;
    display: flex; align-items: center; justify-content: center;
  }

  .lb-body { padding: 0 6px 8px; }
  .lb-state {
    padding: 24px 6px; text-align: center;
    color: var(--muted); font-size: 13px;
  }

  /* Session history rows */
  .hist-row {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--line);
    text-decoration: none; color: inherit;
  }
  .hist-row:last-child { border-bottom: none; }
  .hist-row:hover { background: #fafafa; }
  .hist-thumb {
    width: 44px; height: 44px; object-fit: cover;
    border-radius: 4px; flex-shrink: 0;
    border: 1px solid var(--line);
  }
  .hist-info { flex: 1; min-width: 0; }
  .hist-title {
    font-size: 12px; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .hist-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
  .hist-badge {
    font-size: 10px; font-weight: 700; letter-spacing: 0.07em;
    padding: 2px 6px; border-radius: 4px; flex-shrink: 0;
  }
  .hist-badge.hist-win { background: #e6f4ea; color: var(--correct); }
  .hist-badge.hist-lose { background: #fdecea; color: #a81f12; }
