:root {
  --ink: #f3ecdc;
  --ink-soft: #c9c1b0;
  --night-1: #0b1430;
  --night-2: #1b2a55;
  --night-3: #3a3f6e;
  --panel: rgba(16, 22, 46, .72);
  --line: rgba(243, 236, 220, .18);
  --gold: #e8bb4a;
  --gold-ink: #2a1d04;
  --focus: #ffe08a;
  --page-bg: linear-gradient(180deg, var(--night-1) 0%, var(--night-2) 55%, var(--night-3) 100%);
  --field: rgba(0, 0, 0, .25);
  --placeholder: #8e8a9e;
  --face: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  color-scheme: dark;
}
/* A design whose text is dark (a daytime scene) switches the page to its light set. */
html.light { --field: rgba(255, 255, 255, .6); --placeholder: rgba(40, 30, 20, .45); --focus: #7a4b00; color-scheme: light; }

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font: 17px/1.5 Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  color: var(--ink);
  background: var(--page-bg);
  background-attachment: fixed;
  overflow-x: hidden;
}

.sky { position: absolute; top: 0; left: 0; right: 0; height: 100vh; pointer-events: none; z-index: 0; }
.moon {
  position: absolute; top: 74px; right: 5vw; width: 44px; height: 44px; border-radius: 50%; opacity: .85;
  background: radial-gradient(circle at 35% 35%, #fffbe8, #e9dfbf 60%, #cfc3a0);
  box-shadow: 0 0 60px 18px rgba(255, 246, 210, .18);
}
.star { position: absolute; width: 2px; height: 2px; border-radius: 50%; background: #fff; opacity: .7; animation: twinkle 4s ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: .15; } }

main { position: relative; z-index: 1; max-width: 560px; margin: 0 auto; padding: 28px 16px 40px; }
header { text-align: center; }
h1, .toss { font-family: var(--face); }
h1 { font-weight: normal; font-size: clamp(30px, 7vw, 44px); margin: 0; letter-spacing: .02em; }
.tagline { margin: 4px 0 0; color: var(--ink-soft); }

.scene { position: relative; margin: 8px -16px 0; }
#well { display: block; width: 100%; height: auto; overflow: visible; }
.status { min-height: 1.6em; text-align: center; margin: 0 16px; color: var(--ink); font-style: italic; transition: opacity .6s; }

form { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 18px; backdrop-filter: blur(6px); }
.lbl { display: block; font-size: 15px; margin-bottom: 6px; }
.hint { color: var(--ink-soft); font-size: 13px; }
textarea {
  width: 100%; resize: vertical; font: inherit; color: var(--ink); background: var(--field);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
}
textarea::placeholder, input::placeholder { color: var(--placeholder); }

fieldset.coins { border: 0; padding: 0; margin: 14px 0 0; }
.coin-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 459px) { .coin-list { grid-template-columns: repeat(2, 1fr); } }
.coin-opt .face.custom { background: conic-gradient(from 30deg, #c8743e, #e2b13c, #c3c9d2, #e2b13c, #c8743e); }
.custom-row { margin-top: 12px; }
.custom-row label { display: block; font-size: 15px; margin-bottom: 6px; }
.usd { display: flex; align-items: center; gap: 6px; font-size: 20px; }
.usd input {
  width: 9em; font: inherit; color: var(--ink); background: var(--field);
  border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px;
}
.usd input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.coin-opt input { position: absolute; opacity: 0; pointer-events: none; }
.coin-opt label {
  display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; text-align: center;
  padding: 10px 4px; border-radius: 12px; border: 1px solid var(--line); font-size: 14px; line-height: 1.25;
}
.coin-opt .face { width: 34px; height: 34px; border-radius: 50%; box-shadow: inset 0 0 0 3px rgba(0,0,0,.18), 0 2px 6px rgba(0,0,0,.4); }
.coin-opt .face.gold { background: radial-gradient(circle at 35% 35%, #fff3b0, #e2b13c 55%, #9c6b12); }
.coin-opt .face.silver { background: radial-gradient(circle at 35% 35%, #fff, #c3c9d2 55%, #6d7480); }
.coin-opt .face.copper { background: radial-gradient(circle at 35% 35%, #ffd2b0, #c8743e 55%, #7a3a14); }
.coin-opt .price { color: var(--ink-soft); font-size: 13px; }
.coin-opt input:checked + label { border-color: var(--gold); background: rgba(232, 187, 74, .12); }
.coin-opt input:focus-visible + label { outline: 2px solid var(--focus); outline-offset: 2px; }

button { font: inherit; cursor: pointer; }
.toss {
  display: block; width: 100%; margin-top: 16px; padding: 13px; border: 0; border-radius: 999px;
  background: var(--gold); color: var(--gold-ink); font-size: 18px; box-shadow: 0 4px 18px rgba(232,187,74,.3);
}
.toss:disabled { opacity: .55; cursor: default; }
button:focus-visible, a:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.demo-banner { text-align: center; margin: 10px 0 0; font-size: 13px; color: #ffd27a; }

footer { text-align: center; color: var(--ink-soft); font-size: 14px; margin-top: 22px; }
footer a, .about a { color: var(--ink); }

dialog {
  width: min(420px, calc(100vw - 32px)); border: 1px solid var(--line); border-radius: 18px; padding: 20px;
  background: #151c3a; color: var(--ink); text-align: center;
}
dialog::backdrop { background: rgba(4, 8, 22, .7); }
dialog h2 { font-weight: normal; margin: 0 0 4px; }
.pay-amount { color: var(--ink-soft); margin: 0 0 12px; }
.qr { display: inline-block; background: #fff; padding: 10px; border-radius: 10px; }
.qr img, .qr canvas { display: block; width: 220px; height: 220px; }
.pay-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.pay-actions a, .pay-actions button {
  padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,.06);
  color: var(--ink); text-decoration: none; font-size: 15px;
}
.pay-actions .primary { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); }
.pay-msg { min-height: 1.5em; color: var(--ink-soft); font-size: 14px; }
.pay-foot { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; }
.methods { display: grid; gap: 8px; text-align: left; }
.method {
  display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: rgba(255,255,255,.05); color: var(--ink); text-align: left;
}
.method:hover:not(:disabled) { border-color: var(--gold); background: rgba(232,187,74,.1); }
.method:disabled { opacity: .45; cursor: default; }
.method .m-label { font-size: 17px; }
.method .m-sub { font-size: 13px; color: var(--ink-soft); }
.pay-detail { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; font-size: 14px; text-align: left; }
.pay-detail .k { color: var(--ink-soft); white-space: nowrap; }
.pay-detail .v { font-size: 13px; word-break: break-all; text-align: right; }
.pay-form { text-align: left; }
.pay-form label { display: block; font-size: 14px; color: var(--ink-soft); margin-bottom: 4px; }
.pay-form select {
  width: 100%; font: inherit; font-size: 15px; color: var(--ink); background: #0f1530;
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px;
}
.pay-note { margin: 0 0 4px; color: var(--ink-soft); }
.paypal-box { background: #fff; border-radius: 14px; padding: 12px 12px 4px; min-height: 60px; }
.wicon { width: 18px; height: 18px; vertical-align: -3px; margin-right: 6px; }
.pay-actions button:disabled { opacity: .45; cursor: default; }
dialog { max-height: calc(100vh - 32px); overflow-y: auto; }
.ghost { background: none; border: 0; color: var(--ink-soft); text-decoration: underline; }

.about { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 8px 20px 18px; }
.about h2 { font-weight: normal; font-size: 22px; margin: 18px 0 6px; }

@media (prefers-reduced-motion: reduce) {
  .star { animation: none; }
}

/* ---------- top bar, language ---------- */
nav.top { display: flex; justify-content: space-between; align-items: center; font-size: 14px; margin-bottom: 6px; }
nav.top a { color: var(--ink-soft); }
.lang { font-size: 15px; color: var(--ink); text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; }

/* ---------- count, buttons under the well ---------- */
.count { text-align: center; margin: 2px 16px 0; color: var(--ink-soft); font-size: 14px; }
.peek-row, .share-row { text-align: center; margin: 8px 0 0; }
.soft {
  padding: 7px 16px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,.06);
  color: var(--ink); font-size: 15px;
}
.soft:hover { border-color: var(--gold); }
.water-click { cursor: pointer; }
.water-click:focus-visible { outline: none; }
.water-click:focus-visible ellipse:first-child { stroke: var(--focus); stroke-width: 2; }

/* ---------- five coin choices ---------- */
.coin-list.five { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 459px) { .coin-list.five { grid-template-columns: repeat(3, 1fr); } }
.coin-opt .face.tin { background: radial-gradient(circle at 35% 35%, #eef2f6, #9aa6b2 55%, #55606c); }

/* ---------- public / private ---------- */
.public-box { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.check { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--gold); }
.note-row { margin-top: 10px; }
.note-row input {
  width: 100%; font: inherit; color: var(--ink); background: rgba(0,0,0,.25);
  border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px;
}
.note-row input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.public-box .hint { margin: 6px 0 0; display: block; }

/* ---------- look inside ---------- */
dialog.peek { width: min(560px, calc(100vw - 20px)); padding: 14px 14px 16px; }
.peek-head { display: flex; justify-content: space-between; align-items: center; }
.peek-head h2 { margin: 0; }
#peek-close { font-size: 28px; line-height: 1; text-decoration: none; padding: 0 6px; }
.peek-count { margin: 2px 0 8px; color: var(--ink-soft); font-size: 14px; }
#peek-svg { display: block; width: 100%; height: auto; max-height: 62vh; margin: 0 auto; }
.pc { cursor: pointer; }
.pc:focus-visible { outline: none; }
.pc:focus-visible circle:nth-of-type(2), .pc:hover circle:nth-of-type(2) { stroke: var(--focus); stroke-width: 2; }
.pc .halo { fill: none; stroke: #ffe9a8; stroke-width: 2; opacity: .55; animation: glow 2.6s ease-in-out infinite; }
@keyframes glow { 50% { opacity: .15; } }
.coin-card { margin-top: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.04); }
.card-note { margin: 0; font-size: 18px; font-style: italic; overflow-wrap: anywhere; }
.card-note.private { font-style: normal; color: var(--ink-soft); }
.card-meta { margin: 6px 0 0; font-size: 13px; color: var(--ink-soft); }
.coin-card .pay-actions { justify-content: flex-start; margin-top: 8px; }
.peek-hint { text-align: center; margin: 10px 0 0; }
@media (prefers-reduced-motion: reduce) { .pc .halo { animation: none; } }
.lang { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; }
.lang select { background: transparent; color: var(--ink); border: 0; font: inherit; font-size: 15px; padding: 3px 2px; cursor: pointer; }
.lang select option { color: #111; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
html[dir="rtl"] body { font-family: "Frank Ruhl Libre", "Noto Naskh Arabic", "David", "Times New Roman", serif; }
.traditions h1 { font-size: clamp(26px, 6vw, 36px); text-align: center; margin: 16px 0 6px; }
.traditions p { line-height: 1.65; }
.cta { text-align: center; margin: 22px 0; }
.cta .toss { display: inline-block; width: auto; padding: 12px 28px; text-decoration: none; }

/* ---------- moving water ---------- */
.flow .shim { transform-box: fill-box; transform-origin: center; animation: drift 7s ease-in-out infinite alternate; }
.flow .s2 { animation-duration: 9s; animation-delay: -3s; }
.flow .s3 { animation-duration: 6s; animation-delay: -1.5s; }
@keyframes drift { from { transform: translateX(-14px) scaleX(.85); opacity: .08; } 50% { opacity: .22; } to { transform: translateX(16px) scaleX(1.1); opacity: .1; } }
.flow .glint { opacity: 0; animation: glint 4.2s ease-in-out infinite; }
.flow .g2 { animation-delay: 1.4s; } .flow .g3 { animation-delay: 2.8s; }
@keyframes glint { 0%, 70%, 100% { opacity: 0; } 80% { opacity: .9; } }
.caustics .cl { transform-box: fill-box; transform-origin: center; animation: caustic 11s ease-in-out infinite alternate; }
.caustics .c2 { animation-duration: 14s; animation-delay: -5s; }
@keyframes caustic { from { transform: translate(-20px, -10px) scale(.9); } to { transform: translate(25px, 15px) scale(1.15); } }
@media (prefers-reduced-motion: reduce) { .flow .shim, .flow .glint, .caustics .cl { animation: none; } }

/* ---------- designs (looks/) ---------- */
html.look-art .sky { display: none; }
/* soften the picture's edges into the page */
html.look-art #well {
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 7%, #000 93%, transparent 100%), linear-gradient(to bottom, transparent 0, #000 6%, #000 90%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent 0, #000 7%, #000 93%, transparent 100%), linear-gradient(to bottom, transparent 0, #000 6%, #000 90%, transparent 100%);
  mask-composite: intersect;
}
.note-row input { background: var(--field); }
/* the pop-up windows keep their own night colours whatever the design */
dialog { --ink: #f3ecdc; --ink-soft: #c9c1b0; --line: rgba(243, 236, 220, .18); --field: rgba(0, 0, 0, .25); --placeholder: #8e8a9e; --focus: #ffe08a; color-scheme: dark; }

/* ---------- language links and the language offer ---------- */
nav.langs { margin: 26px 0 0; text-align: center; font-size: 13px; line-height: 2; color: var(--ink-soft); }
nav.langs a { color: var(--ink-soft); }
nav.langs [aria-current] { color: var(--ink); }
.lang-offer {
  position: absolute; z-index: 5; top: max(10px, env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%);
  background: var(--gold); color: var(--gold-ink); border-radius: 999px; padding: 6px 16px; text-decoration: none; font-size: 15px;
  box-shadow: 0 4px 14px rgba(0,0,0,.35);
}

/* ---------- home page words ---------- */
.brand { font-family: var(--face); font-size: clamp(18px, 4.6vw, 24px); letter-spacing: .06em; margin: 0 0 4px; color: var(--ink-soft); }
header h1 { font-size: clamp(26px, 6.4vw, 38px); text-wrap: balance; }
.honest { text-align: center; margin: 10px 0 0; font-size: 14px; color: var(--ink-soft); font-style: italic; }
.faq { margin: 26px 0 0; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 6px 18px 14px; }
.faq h2 { font-weight: normal; font-size: 22px; margin: 14px 0 4px; }
.faq h3 { font-size: 17px; margin: 14px 0 2px; }
.faq p { margin: 0 0 6px; color: var(--ink-soft); line-height: 1.55; }
.faq a { color: var(--ink); }

.trad-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 6px; }
.trad-list a { border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; text-decoration: none; color: var(--ink); font-size: 15px; }
.trad-list a:hover { border-color: var(--gold); }
