/* Public voting site. Mobile first, one column, soft ivory and champagne gold. */
:root {
  --bg: #fbf8f3;
  --surface: #ffffff;
  --ink: #2a2622;
  --muted: #857b70;
  --faint: #b5aa9e;
  --line: #ebe3d8;
  --gold: #b08d57;
  --gold-deep: #8d6d3c;
  --gold-soft: #f4ecdf;
  --blush: #f6ebe6;
  --danger: #b4443c;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(42, 38, 34, 0.05), 0 10px 30px rgba(42, 38, 34, 0.07);
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: "Jost", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  font-weight: 300;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
img { display: block; max-width: 100%; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---- header ---- */
.masthead {
  text-align: center;
  padding: 26px 16px 14px;
}
.masthead .eyebrow {
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 8px;
}
.masthead h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 38px;
  line-height: 1.05;
  margin: 0;
  letter-spacing: 0.01em;
}
.masthead .tagline {
  margin: 10px auto 0;
  max-width: 34ch;
  color: var(--muted);
  font-size: 15px;
}
.masthead .rule {
  width: 56px; height: 1px; margin: 16px auto 0;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.who {
  display: flex; justify-content: center; align-items: center; gap: 10px;
  margin-top: 12px; font-size: 13px; color: var(--muted);
}
.who b { font-weight: 500; color: var(--ink); }
.linkbtn {
  border: 0; background: none; padding: 0;
  color: var(--gold-deep); text-decoration: underline; text-underline-offset: 3px; font-size: 13px;
}

/* ---- countdown ribbon ---- */
.ribbon {
  position: sticky; top: 0; z-index: 30;
  margin: 0 12px 4px;
  padding: 8px 14px;
  border-radius: 14px;
  background: rgba(42, 38, 34, 0.94);
  color: #fbf8f3;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(42, 38, 34, 0.18);
  display: flex; align-items: center; gap: 12px;
}
.ribbon .ico { font-size: 16px; line-height: 1; flex: none; opacity: 0.9; }
.ribbon .text { flex: 1; min-width: 0; }
.ribbon .lead { font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: #d9c29a; }
.ribbon .count {
  font-family: var(--serif); font-size: 19px; font-weight: 500; line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.ribbon .note { font-size: 13px; color: rgba(251, 248, 243, 0.78); margin-top: 1px; }
.ribbon.closed { background: var(--gold-deep); }
.ribbon.closed .lead { color: rgba(255,255,255,0.75); }
.ribbon.soon { background: #7a3b35; }
@media (min-width: 640px) {
  .ribbon { margin: 0 auto 4px; max-width: 640px; }
}

/* ---- tabs ---- */
.tabs {
  display: flex; gap: 4px;
  margin: 12px 16px 0;
  padding: 4px;
  background: var(--gold-soft);
  border-radius: 999px;
}
.tabs button {
  flex: 1; border: 0; background: transparent;
  padding: 10px 8px; border-radius: 999px;
  font-size: 14px; font-weight: 400; color: var(--muted);
  min-height: 44px;
}
.tabs button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,0.08); font-weight: 500; }
.tabs button .n { font-size: 12px; color: var(--faint); margin-left: 4px; }

/* ---- sort ---- */
.sortbar { display: flex; align-items: center; gap: 10px; margin: 12px auto 0; padding: 0 16px; max-width: 640px; }
.sortbar label { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.sortbar select {
  flex: 1; min-width: 0; min-height: 46px; padding: 0 40px 0 16px; font-size: 16px; font-weight: 400; color: var(--ink);
  border: 1px solid var(--line); border-radius: 999px; background-color: var(--surface);
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23857b70' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center;
}
.sortbar select:focus { outline: 2px solid var(--gold); outline-offset: -1px; border-color: var(--gold); }
.avgline { padding: 0 18px 10px; font-size: 13px; color: var(--muted); }
.avgline b { font-family: var(--serif); font-size: 18px; font-weight: 600; color: var(--gold-deep); margin: 0 2px; }

main { padding: 14px 16px 60px; max-width: 640px; margin: 0 auto; }
.hint { color: var(--muted); font-size: 14px; text-align: center; margin: 4px 0 14px; }

/* ---- sign in card ---- */
.signin {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 18px;
  margin-bottom: 18px;
  border: 1px solid transparent;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.signin.attention { border-color: var(--gold); box-shadow: 0 0 0 4px var(--gold-soft), var(--shadow); }
.signin h2 { font-family: var(--serif); font-weight: 500; font-size: 24px; margin: 0 0 4px; }
.signin p { margin: 0 0 14px; color: var(--muted); font-size: 14px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%; border: 1px solid var(--line); border-radius: 12px;
  background: #fff; padding: 13px 14px; font-size: 16px; font-weight: 400;
}
.field input:focus { outline: 2px solid var(--gold); outline-offset: -1px; border-color: var(--gold); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--surface);
  border-radius: 999px; padding: 12px 20px; font-size: 15px; font-weight: 400;
  min-height: 46px; text-decoration: none; white-space: nowrap;
}
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.gold { background: var(--gold); color: #fff; border-color: var(--gold); }
.btn.block { width: 100%; }
.btn.small { padding: 8px 14px; min-height: 36px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: default; }
.signin .actions { display: flex; gap: 10px; align-items: center; margin-top: 4px; }
.error { color: var(--danger); font-size: 14px; margin-top: 10px; min-height: 1em; }
.back { color: var(--muted); font-size: 13px; border: 0; background: none; padding: 0; text-decoration: underline; text-underline-offset: 3px; }

/* ---- ring card ---- */
.ring {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 22px;
}
.ring .head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 16px 18px 10px;
}
.ring .num { font-family: var(--serif); font-size: 26px; font-weight: 500; line-height: 1; }
.ring .num small { font-size: 13px; font-family: var(--sans); font-weight: 300; letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold); margin-right: 8px; vertical-align: 2px; }
.ring .mine {
  font-size: 13px; color: var(--muted);
}
.ring .mine b { font-family: var(--serif); font-size: 22px; font-weight: 500; color: var(--gold-deep); margin-left: 4px; vertical-align: -2px; }

/* photo strip: swipe to see each angle */
.strip { position: relative; background: #f5f1ea; }
.strip .track {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.strip .track::-webkit-scrollbar { display: none; }
.strip .slide { flex: 0 0 100%; aspect-ratio: 1; scroll-snap-align: start; position: relative; }
.strip .slide img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.strip .slide.band img { object-fit: contain; background: #fff; padding: 8%; }
.strip .slide .tag {
  position: absolute; left: 12px; bottom: 12px;
  background: rgba(42,38,34,0.72); color: #fff; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  padding: 5px 10px; border-radius: 999px; backdrop-filter: blur(4px);
}
.strip .none { aspect-ratio: 1; display: grid; place-items: center; color: var(--faint); font-size: 14px; }
.strip .dots {
  position: absolute; left: 0; right: 0; bottom: 10px;
  display: flex; justify-content: center; gap: 5px; pointer-events: none;
}
.strip .dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,0.55); box-shadow: 0 0 2px rgba(0,0,0,0.3); transition: transform 0.15s, background 0.15s; }
.strip .dots i.on { background: #fff; transform: scale(1.25); }
.strip .counter {
  position: absolute; top: 12px; right: 12px;
  background: rgba(42,38,34,0.6); color: #fff; font-size: 12px; font-variant-numeric: tabular-nums;
  padding: 3px 9px; border-radius: 999px; backdrop-filter: blur(4px);
}
.strip .arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; border-radius: 50%; border: 0;
  background: rgba(255,255,255,0.85); color: var(--ink); font-size: 20px; line-height: 1;
  display: none; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.strip .arrow.l { left: 10px; } .strip .arrow.r { right: 10px; }
@media (hover: hover) and (pointer: fine) { .strip:hover .arrow { display: flex; } }

/* specs */
.specs {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px;
  background: var(--line); margin: 0;
}
.specs > div { background: var(--surface); padding: 12px 18px; }
.specs .k { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.specs .v { font-family: var(--serif); font-size: 22px; font-weight: 500; line-height: 1.15; margin-top: 2px; }
.specs .v small { font-size: 14px; font-family: var(--sans); font-weight: 300; color: var(--muted); margin-left: 3px; }
.specs .v.na { color: var(--faint); font-size: 18px; font-style: italic; font-weight: 400; }
@media (min-width: 480px) { .specs { grid-template-columns: repeat(4, 1fr); } }
/* locked slider under Color and Clarity: where the grade sits, better to the right */
.gscale { margin-top: 10px; }
.gtrack { position: relative; height: 4px; margin: 8px 8px 0; border-radius: 999px; background: var(--line); }
.gtrack .gfill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: linear-gradient(90deg, #e3d2b4, var(--gold)); }
.gtrack .gbetter { position: absolute; right: 0; top: 0; bottom: 0; border-radius: 0 999px 999px 0; background: repeating-linear-gradient(90deg, #dcc59c 0 3px, transparent 3px 6px); }
.gtrack i { position: absolute; top: 50%; width: 2px; height: 2px; margin: -1px 0 0 -1px; border-radius: 50%; background: rgba(255,255,255,0.9); }
.gtrack .gthumb {
  position: absolute; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%;
  background: var(--gold); border: 3px solid #fff; box-shadow: 0 1px 4px rgba(42,38,34,0.35);
}
.gends { display: flex; justify-content: space-between; margin-top: 9px; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }

.subline {
  padding: 10px 18px 0; font-size: 13px; color: var(--muted); letter-spacing: 0.04em;
}
.subline span + span::before { content: "·"; margin: 0 8px; color: var(--faint); }

/* compact to-scale stone, bottom right of the photos */
.handbadge {
  position: absolute; right: 10px; bottom: 10px; z-index: 2;
  width: 92px; padding: 0 0 6px; margin: 0;
  border: 1px solid rgba(255,255,255,0.9); border-radius: 14px; overflow: hidden;
  background: var(--bg); color: var(--ink); text-align: center;
  box-shadow: 0 4px 16px rgba(42,38,34,0.22);
  display: flex; flex-direction: column; align-items: stretch;
}
button.handbadge { cursor: pointer; }
button.handbadge:active { transform: scale(0.97); }
.handbadge .hand-mini { display: block; width: 100%; aspect-ratio: 1; border-bottom: 1px solid var(--line); }
.handbadge .ct { font-family: var(--serif); font-size: 17px; font-weight: 600; line-height: 1.1; margin-top: 5px; font-variant-numeric: tabular-nums; }
.handbadge .mm { font-size: 10px; color: var(--muted); line-height: 1.3; margin-top: 1px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.handbadge .cap { font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); line-height: 1.3; }
@media (min-width: 480px) { .handbadge { width: 108px; } .handbadge .ct { font-size: 19px; } .handbadge .mm { font-size: 11px; } }

/* to-scale stone on a finger */
.hand { margin: 14px 18px 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--bg); display: grid; grid-template-columns: 1fr; }
.hand figcaption { padding: 12px 14px 10px; }
.hand .k { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); }
.hand .v { font-family: var(--serif); font-size: 22px; font-weight: 500; line-height: 1.15; margin-top: 2px; font-variant-numeric: tabular-nums; }
.hand p { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.hand-svg { display: block; width: 100%; height: auto; aspect-ratio: 84 / 58; border-top: 1px solid var(--line); }
@media (min-width: 560px) {
  .hand { grid-template-columns: 1fr 1.25fr; align-items: center; }
  .hand-svg { border-top: 0; border-left: 1px solid var(--line); }
}

/* score bar */
.score {
  padding: 14px 18px 18px;
}
.score .lab {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted);
  margin-bottom: 8px;
}
.score .lab .word { font-family: var(--serif); text-transform: none; letter-spacing: 0; font-size: 17px; color: var(--gold-deep); font-style: italic; }
.bar {
  display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px;
}
.bar button {
  height: 46px; border: 1px solid var(--line); background: #fff; border-radius: 8px;
  font-size: 14px; font-weight: 400; color: var(--muted); padding: 0;
  transition: background 0.12s, color 0.12s, transform 0.08s;
}
.bar button:first-child { border-radius: 12px 8px 8px 12px; }
.bar button:last-child { border-radius: 8px 12px 12px 8px; }
.bar button.lit { background: var(--gold-soft); border-color: #e3d2b4; color: var(--gold-deep); }
.bar button.on { background: var(--gold); border-color: var(--gold); color: #fff; font-weight: 500; transform: scale(1.06); }
.bar button:active { transform: scale(0.96); }
.bar.off button { opacity: 0.45; pointer-events: none; }
.score .ends { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); margin-top: 6px; letter-spacing: 0.06em; }
.score .locked { text-align: center; font-size: 13px; color: var(--muted); margin-top: 8px; }
.score .clear { margin-top: 10px; text-align: right; }

/* note */
.note { padding: 0 18px 18px; }
.note textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; background: #fff;
  padding: 11px 13px; font-size: 15px; font-weight: 300; min-height: 72px; resize: vertical;
}
.note textarea:focus { outline: 2px solid var(--gold); outline-offset: -1px; }
.note .meta { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--faint); margin-top: 6px; min-height: 1em; }
.note .saved { color: var(--gold-deep); }

/* ---- ranking ---- */
.rank-tools { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-bottom: 14px; }
.ranklist { list-style: none; margin: 0; padding: 0; }
.rankitem {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow);
  padding: 10px 12px 10px 14px; margin-bottom: 10px;
  touch-action: pan-y;
}
.rankitem .pos { font-family: var(--serif); font-size: 24px; font-weight: 500; width: 30px; text-align: center; color: var(--gold-deep); flex: none; font-variant-numeric: tabular-nums; }
.rankitem .thumb { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; background: #f5f1ea; flex: none; }
.rankitem .info { flex: 1; min-width: 0; }
.rankitem .info .t { font-family: var(--serif); font-size: 19px; font-weight: 500; line-height: 1.1; }
.rankitem .info .t small { font-family: var(--sans); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold); margin-right: 6px; font-weight: 300; }
.rankitem .info .s { font-size: 12px; color: var(--muted); margin-top: 3px; }
.rankitem .grip {
  width: 44px; height: 56px; flex: none; display: grid; place-items: center;
  color: var(--faint); cursor: grab; touch-action: none; border-radius: 10px;
}
.rankitem .grip:active { cursor: grabbing; background: var(--gold-soft); }
.rankitem .moves { display: flex; flex-direction: column; gap: 2px; flex: none; }
.rankitem .moves button { width: 36px; height: 27px; border: 1px solid var(--line); background: #fff; border-radius: 8px; font-size: 13px; color: var(--muted); padding: 0; }
.rankitem .moves button:disabled { opacity: 0.3; }
.sortable-ghost { opacity: 0.35; }
.sortable-chosen { box-shadow: 0 6px 24px rgba(42,38,34,0.18); }
.rank-foot { text-align: center; font-size: 13px; color: var(--muted); margin-top: 14px; }

.empty { text-align: center; color: var(--muted); padding: 60px 20px; font-family: var(--serif); font-size: 20px; }
footer { text-align: center; color: var(--faint); font-size: 12px; padding: 20px 16px 40px; }
footer a { color: var(--faint); }

/* ---- toast ---- */
#toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(16px);
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 999px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: all 0.2s ease; z-index: 100;
  max-width: calc(100% - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
