:root {
  --bg: #fbf8f2; --bar: #ffffff; --ink: #1f1d1a; --muted: #6f6a62; --line: #e6dfd3;
  --accent: #c2502b; --accent-ink: #ffffff; --chip: #efebe4; --save: #b8325a; --shadow: rgba(0,0,0,.08);
  --go: #2e7d4f; --go-ink: #ffffff;
  --like: #2e7d4f; --like-bg: #e3f2e8; --skip: #a33a2b; --skip-bg: #f8e3df;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1916; --bar: #23211d; --ink: #ece7de; --muted: #a39d92; --line: #38342e;
    --accent: #e07a52; --accent-ink: #1a1916; --chip: #2d2a25; --save: #f07a9a; --shadow: rgba(0,0,0,.4);
    --like: #7fd19b; --like-bg: #1f3427; --skip: #f08f7f; --skip-bg: #3a221e;
  }
}
:root[data-theme="dark"] {
  --bg: #1a1916; --bar: #23211d; --ink: #ece7de; --muted: #a39d92; --line: #38342e;
  --accent: #e07a52; --accent-ink: #1a1916; --chip: #2d2a25; --save: #f07a9a; --shadow: rgba(0,0,0,.4);
    --like: #7fd19b; --like-bg: #1f3427; --skip: #f08f7f; --skip-bg: #3a221e;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.4 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
       display: flex; flex-direction: column; overflow: hidden; }
a { color: inherit; }
button { font: inherit; color: var(--ink); background: var(--bar); border: 1px solid var(--line); border-radius: 10px;
         padding: 8px 12px; cursor: pointer; white-space: nowrap; }
button:hover { border-color: var(--muted); }
button:disabled { opacity: .4; cursor: default; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.primary { background: var(--ink); border-color: var(--ink); color: var(--bg); font-weight: 650; padding: 8px 18px; border-radius: 999px; }
.primary:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.saved-on { color: var(--save); border-color: var(--save); }

.bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--bar);
       border-bottom: 1px solid var(--line); min-height: 56px; }
.brand { font: 600 18px Georgia, "Iowan Old Style", serif; text-decoration: none; }
.brand span { color: var(--accent); }
.site { flex: 1 1 260px; min-width: 0; }
.site .dom { font-weight: 600; overflow-wrap: anywhere; }
.site .top { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.open-link { flex: none; border: 0; background: none; padding: 0 4px; color: var(--muted); font-size: 14px; border-radius: 6px; }
.open-link:hover { color: var(--ink); background: var(--chip); }
.open-link[hidden] { display: none; }
.site .hook { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip { font-size: 12px; background: var(--chip); border-radius: 999px; padding: 1px 8px; margin-left: 6px; }
.controls { display: flex; gap: 4px; align-items: center; }
.controls button { border: 0; background: transparent; border-radius: 999px; padding: 8px 12px; font-weight: 550; }
.controls button:hover:not(:disabled) { background: var(--chip); }
.ghost { color: var(--muted); }
.ghost:hover:not(:disabled) { color: var(--ink); }
.rate { display: flex; gap: 2px; padding: 3px; margin: 0 4px; background: var(--chip); border-radius: 999px; }
.rate button { padding: 6px 14px; color: var(--ink); }
.rate button:hover:not(:disabled) { background: var(--bar); }
.like.on, .like.on:hover:not(:disabled) { background: var(--like); color: #fff; }
.skip.on, .skip.on:hover:not(:disabled) { background: var(--skip); color: #fff; }
.controls .next { color: #fff; padding: 10px 20px 10px 16px; margin-left: 8px; font-weight: 700; letter-spacing: .01em;
                  background: linear-gradient(120deg, #ff5f6d 0%, #ff8a3d 50%, #ffc23d 100%); background-size: 160% 100%;
                  background-position: 0% 0; text-shadow: 0 1px 1px rgba(120,40,0,.25);
                  box-shadow: 0 2px 0 rgba(160,60,20,.25), 0 6px 18px rgba(255,120,60,.35);
                  transition: background-position .35s, transform .15s, box-shadow .15s; }
.controls .next:hover:not(:disabled) { background: linear-gradient(120deg, #ff5f6d 0%, #ff8a3d 50%, #ffc23d 100%);
                  background-size: 160% 100%; background-position: 100% 0; transform: translateY(-1px);
                  box-shadow: 0 3px 0 rgba(160,60,20,.25), 0 10px 24px rgba(255,120,60,.45); }
.controls .next:active { transform: translateY(1px) scale(.97); box-shadow: 0 1px 0 rgba(160,60,20,.25), 0 3px 8px rgba(255,120,60,.3); }
.next .die { display: inline-block; margin-right: 2px; }
.next:hover .die { animation: wobble .6s ease-in-out; }
.next.boing { animation: boing .45s cubic-bezier(.3,1.6,.5,1); }
.next.boing .die { animation: roll .5s cubic-bezier(.3,1.4,.5,1); }
@keyframes boing { 0% { transform: scale(.92); } 60% { transform: scale(1.06); } 100% { transform: scale(1); } }
@keyframes roll { from { transform: rotate(0) scale(1.2); } to { transform: rotate(360deg) scale(1); } }
@keyframes wobble { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-14deg); } 75% { transform: rotate(14deg); } }
@media (prefers-reduced-motion: reduce) { .next, .next .die { animation: none !important; transition: none !important; } }
.likes { color: var(--save); font-weight: 600; border-radius: 999px; padding: 7px 13px; margin-left: 4px; }
kbd { display: none; }

main { flex: 1; position: relative; min-height: 0; }
iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
.card { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 20px; overflow: auto; }
.card .inner { max-width: 560px; width: 100%; background: var(--bar); border: 1px solid var(--line); border-radius: 16px;
               padding: 28px; box-shadow: 0 8px 30px var(--shadow); }
.card h1 { font: 700 28px/1.15 Georgia, serif; margin: 0 0 8px; overflow-wrap: anywhere; }
.card p { color: var(--muted); margin: 0 0 18px; }
.card .big { font-size: 17px; padding: 12px 22px; }
.note { font-size: 13px; color: var(--muted); margin-top: 14px !important; }

.panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100%); background: var(--bar);
         border-left: 1px solid var(--line); box-shadow: -8px 0 30px var(--shadow); padding: 16px; overflow: auto; z-index: 10; }
.panel[hidden] { display: none; }
.panel header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.panel h2 { font: 700 20px Georgia, serif; margin: 0; }
.panel ul { list-style: none; padding: 0; margin: 0; }
.panel li { padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: flex-start; }
.panel li div { flex: 1; min-width: 0; }
.panel li a { font-weight: 650; overflow-wrap: anywhere; }
.panel li small { color: var(--muted); display: block; }
.panel .empty { color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: var(--ink); color: var(--bg);
         padding: 8px 14px; border-radius: 999px; font-size: 14px; z-index: 20; pointer-events: none;
         opacity: 0; transition: opacity .2s; }
.toast.show { opacity: 1; }

/* phones: site info on top; along the bottom a tab bar (icon over a word) and a full-width Next site */
@media (max-width: 760px) {
  .bar { flex-wrap: wrap; gap: 4px 10px; }
  .brand { flex: 1; }
  .site { order: 3; flex-basis: 100%; }
  .controls { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; flex-wrap: wrap; gap: 2px;
              padding: 4px 10px calc(10px + env(safe-area-inset-bottom)); background: var(--bar); border-top: 1px solid var(--line); }
  .rate { display: contents; }
  .controls button:not(.next) { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px;
              padding: 6px 2px; font-size: 20px; line-height: 1.1; border-radius: 12px; }
  .controls .lbl { display: block; font-size: 11px; font-weight: 600; letter-spacing: .01em; }
  .controls .ghost .lbl { color: var(--muted); }
  .controls .next { flex-basis: 100%; margin: 4px 0 0; padding: 13px 10px; font-size: 17px; }
  main { margin-bottom: calc(122px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(140px + env(safe-area-inset-bottom)); }
}
