:root{
  --bg: #F7F5F2;
  --card: #FFFFFF;
  --text: #2B2E34;
  --muted: #6B6E73;
  --accent: #D46A6A;     /* Candle Ember */
  --accent2:#C9B8A6;     /* Soft Clay */
  --border:#E4E1DC;
  --shadow: rgba(0,0,0,0.08);
  --danger:#9C4A3C;
}

/* Reset */
*{ box-sizing:border-box; margin:0; padding:0; }
html,body{ height:100%; }
body{
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* Header */
.topbar{
  display:flex;
  justify-content:center;
  align-items:center;
  padding: 18px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.brand-lockup{ height: 100px; }

/* App container */
.app{
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

/* IMPORTANT: screen routing */
.screen{ display:none; }
.screen.active{ display:block; }

h1{
  font-size: 42px;
  letter-spacing: -0.5px;
  margin-bottom: 10px;
}

.sub{
  font-size: 17px;
  color: var(--muted);
  margin-bottom: 22px;
}

h2{
  color: var(--text);
}

/* Utility */
.muted{
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

/* Card */
.card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 22px;
  box-shadow: 0 20px 40px var(--shadow);
}

/* Controls */
.controls{ margin-top: 6px; }
.controls-grid{
  display:grid;
  gap: 16px;
}

.field{
  display:flex;
  flex-direction:column;
  gap: 6px;
}

.label{
  font-size: 14px;
  color: var(--muted);
}

select, .input{
  width:100%;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 15px;
}

select:focus, .input:focus{
  outline: none;
  border-color: var(--accent);
}

/* Buttons */
.btn{
  border:none;
  border-radius: 18px;
  padding: 14px 18px;
  font-size: 16px;
  cursor: pointer;
  transition: opacity .15s ease, transform .15s ease;
}

.btn:active{ transform: translateY(1px); }

.btn.primary{
  background: var(--accent);
  color:#fff;
  font-weight: 800;
  width: 100%;
}

.btn.ghost{
  background: transparent;
  color: var(--muted);
  padding: 14px 14px;
  text-decoration: none;
}

.btn.outline{
  background: transparent;
  color: var(--text);
  border: 1px solid var(--accent2);
  text-decoration: none;
}

.btn.danger{
  background: var(--danger);
  color:#fff;
}

.btn-row{
  display:flex;
  gap: 12px;
  align-items:center;
  margin-top: 16px;
  flex-wrap: wrap;
}

/* “How it works” list (new homepage copy) */
.card ul{
  margin-left: 18px;
}
.card li{
  margin: 6px 0;
  line-height: 1.55;
}

/* How to play dropdown */
.pre-game-note details{
  margin-top: 10px;
  padding-top: 6px;
  border-top: 1px solid rgba(0,0,0,0.06);
}

.pre-game-note summary{
  cursor:pointer;
  font-weight: 800;
  color: var(--text);
  list-style:none;
  user-select: none;
}

.pre-game-note summary::-webkit-details-marker{ display:none; }

/* More options */
.more-options{
  margin-top: 14px;
}

.more-options summary{
  cursor:pointer;
  font-weight: 700;
  color: var(--muted);
  list-style:none;
  user-select: none;
}

.more-options summary::-webkit-details-marker{ display:none; }

/* Fine print */
.fineprint{
  margin-top: 16px;
  text-align:center;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

/* Flip screen */
.flip-wrap{
  margin-top: 24px;
  text-align:center;
}
.coin{ font-size: 42px; margin: 10px 0; }
.flip-actions{
  display:flex;
  gap: 12px;
  justify-content:center;
  margin-top: 14px;
}

/* Play screen */
.play-top{
  display:flex;
  justify-content:space-between;
  margin-bottom: 12px;
}
.pill{
  background: var(--accent2);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
}

.prompt-title{ font-size: 20px; margin-bottom: 10px; }
.prompt-text{ font-size: 18px; line-height: 1.5; margin-bottom: 18px; }
.prompt-actions{ display:flex; gap: 12px; }

/* Footer actions */
.footer-actions{ margin-top: 14px; }

/* Toast */
.toast{
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: var(--text);
  color:#fff;
  padding: 10px 16px;
  border-radius: 999px;
  opacity: 0;
  pointer-events:none;
  transition: opacity .2s ease;
}
.toast.show{ opacity: 1; }

/* Dialog modals */
dialog.modal{
  border: none;
  border-radius: 18px;
  padding: 0;
  max-width: 460px;
  width: min(92vw, 460px);
}
.modal-inner{ padding: 20px; }
.modal-inner h2, .modal-inner h3{ margin-bottom: 8px; }
.modal-inner ul{ margin: 10px 0 10px 18px; }
.modal-actions{
  margin-top: 14px;
  display:flex;
  gap: 10px;
  flex-wrap:wrap;
}

/* Simple form row types used in modals */
.check, .radio{
  display:flex;
  gap:10px;
  align-items:flex-start;
  margin: 10px 0;
}
.check input, .radio input{
  margin-top: 4px;
}

/* Mobile */
@media (max-width:520px){
  h1{ font-size: 34px; }
  .btn-row{ flex-direction: column; }
  .prompt-actions{ flex-direction: column; }
  .card{ padding: 18px; }
}
.micro {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

details.help {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

details.help summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--text);
  list-style: none;
  user-select: none;
}

details.help summary::-webkit-details-marker {
  display: none;
}

details.help ol {
  margin: 10px 0 6px 18px;
  line-height: 1.55;
}

details.help li {
  margin: 6px 0;
}
.micro{
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

details.help{
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(0,0,0,0.06);
}

details.help summary{
  cursor: pointer;
  font-weight: 800;
  color: var(--text);
  list-style: none;
  user-select: none;
}

details.help summary::-webkit-details-marker{ display:none; }

details.help ol{
  margin: 10px 0 6px 18px;
  line-height: 1.55;
}

details.help li{ margin: 6px 0; }
.micro{
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

details.help{
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(0,0,0,0.06);
}

details.help summary{
  cursor: pointer;
  font-weight: 800;
  color: var(--text);
  list-style: none;
  user-select: none;
}

details.help summary::-webkit-details-marker{ display:none; }

details.help ol{
  margin: 10px 0 6px 18px;
  line-height: 1.55;
}

details.help li{ margin: 6px 0; }
/* =====================================================
   PAYWALL / MODAL FIXES
   - Centers dialog (prevents top-left bug)
   - Adds backdrop
   - Matches link colors to CandleTurn accent
===================================================== */

/* Center all open dialogs */
dialog.modal[open] {
  position: fixed;
  inset: 0;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Dimmed background behind modal */
dialog.modal::backdrop {
  background: rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(2px);
}

/* Modal container polish */
dialog.modal {
  border: none;
  border-radius: 18px;
  padding: 0;
  max-width: 460px;
  width: min(92vw, 460px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25);
}

/* Inner spacing (already used, just reinforced) */
.modal-inner {
  padding: 22px;
}

/* Brand-consistent link styling inside modals */
dialog.modal a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

/* Hover state */
dialog.modal a:hover {
  opacity: 0.85;
}

/* Prevent accidental text selection */
dialog.modal * {
  -webkit-tap-highlight-color: transparent;
}
dialog.modal {
  animation: modalIn .18s ease-out;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.96);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}
/* --- Homepage How-it-works strip --- */
.how-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 10px 0 18px;
}

.how-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.65);
  border-radius: 999px;
  font-size: 14px;
  color: var(--text);
}

.how-num {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent2);
  font-weight: 800;
  font-size: 12px;
}

/* Home: two-button row (Start + Demo) */
.btn-row.two .btn {
  flex: 1;
  min-width: 220px;
}
/* --- Demo conversion CTA (End screen) --- */
.demo-cta {
  margin: 0 0 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
}

.demo-cta-title {
  font-weight: 800;
  font-size: 16px;
  margin-bottom: 4px;
}

.demo-cta-sub {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 12px;
}

.demo-cta-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.demo-cta-actions .btn {
  flex: 1;
  min-width: 220px;
}

.demo-cta-fine {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

/* --- Home helper text --- */
.sub-quiet{ display:block; margin-top:6px; font-size:0.95em; opacity:0.9; }
.deck-hint{ margin-top:8px; font-size:13px; color: var(--muted); line-height:1.4; }
.home-links{ margin-top:12px; }
.quiet-link{ color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
.quiet-link:hover{ opacity:0.9; }
.modal-bullets{ margin:0; padding-left:18px; }
.modal-bullets li{ margin:6px 0; }


/* ===== CandleTurn hotfix: center logo + readable deck hint ===== */

/* Center the logo in the top bar even if right-side actions appear later */
header.topbar{
  display: grid !important;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding-top: 16px;
  padding-bottom: 16px;
}

header.topbar .brand{
  grid-column: 2;
  justify-self: center;
  display: flex;
  align-items: center;
}

header.topbar .top-actions{
  grid-column: 3;
  justify-self: end;
}

/* Ensure the lockup image stays crisp and doesn't shift layout */
.brand-lockup{
  display: block;
  height: 36px;
  width: auto;
}

/* Deck description pill / hint (the “Playful — …” line) */
.deck-hint,
#deckHint,
.deck-desc,
.deck-description{
  background: #f4efe9 !important;   /* warm sand */
  color: #2f2f2f !important;        /* readable charcoal */
  border: 1px solid rgba(0,0,0,.06);
  border-left: 4px solid #d46a6a;   /* brand accent */
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.4;
}

/* If the hint is rendered as a “disabled” looking pill, force readable opacity */
.deck-hint *,
#deckHint *,
.deck-desc *,
.deck-description *{
  opacity: 1 !important;
}

/* Fix missing CSS var used by links in some builds */
:root{
  --link: #d46a6a;
}

a{
  color: var(--link);
}
a:hover{
  opacity: .9;
}


/* === CandleTurn FINAL UI FIXES === */

/* Center logo reliably */
.topbar{
  display: grid !important;
  grid-template-columns: 1fr auto 1fr !important;
  align-items: center !important;
}
.topbar .brand{
  grid-column: 2 !important;
  justify-self: center !important;
}
.brand-lockup{
  height: 64px !important;
  width: auto !important;
}

/* Deck hint readability */
#deckHint.deck-hint,
.deck-hint{
  background: #f4efe9 !important;
  color: #2f2f2f !important;
  border-left: 4px solid #d46a6a !important;
  padding: 12px 14px !important;
  border-radius: 12px !important;
  font-size: 14px !important;
  line-height: 1.45 !important;
}


/* Button loading state */
.btn.is-loading{opacity:.85; cursor:progress;}
.btn.is-loading:active{transform:none;}
