/* The palette below is also repeated on .gabdice-wrap. It is mirrored on
   :root because the email modal is a direct child of <body>, OUTSIDE the
   wrap, so its var() lookups previously failed and fell back to inherited
   values — leaving the input transparent, the focus ring dark instead of
   yellow, and error text navy instead of coral. */
:root {
  --ink: #17223b;
  --cream: #fff8e8;
  --coral: #ff615a;
  --yellow: #ffd84d;
  --blue: #2e62d3;
  --mint: #9ee7ce;
  --paper: #fffdf8;
}

.gabdice-wrap {
  --ink: #17223b;
  --cream: #fff8e8;
  --coral: #ff615a;
  --yellow: #ffd84d;
  --blue: #2e62d3;
  --mint: #9ee7ce;
  --paper: #fffdf8;
  font-family: "DM Sans", system-ui, sans-serif;
  color: var(--ink);
  padding: 18px 20px 24px;
  box-sizing: border-box;
  width: 100%;
  overflow-x: hidden;
}
.gabdice-wrap *,
.gabdice-wrap *::before,
.gabdice-wrap *::after { box-sizing: border-box; }

.gabdice-wrap button, .gabdice-wrap input { font: inherit; }
.gabdice-wrap button { cursor: pointer; }
.gabdice-wrap button:focus-visible,
.gabdice-wrap input:focus-visible { outline: 4px solid var(--yellow); outline-offset: 3px; }

.game-frame { width: 100%; max-width: 1320px; margin: 0 auto; }

.game-title {
  font-family: "Fraunces", Georgia, serif;
  letter-spacing: -.06em; line-height: .88; margin: 0;
  font-weight: 800; font-size: clamp(1.5rem, 3vw, 2rem);
}
.game-subtitle { margin: 4px 0 0; font-size: .95rem; font-weight: 700; line-height: 1.3; }

.outline-card { border: 3px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); }
.topbar {
  border-radius: 22px; padding: 14px 16px; margin-top: 12px;
  background: var(--mint);
}
.topbar-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; position: relative; }
.topbar-controls { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }

.round-pill {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  min-width: 150px; padding: 10px 14px; text-align: center;
  background: var(--yellow); color: var(--ink); font-weight: 800; font-size: .78rem;
  border: 2px solid var(--ink); border-radius: 999px;
  letter-spacing: .08em; text-transform: uppercase; white-space: nowrap;
}

.game-button {
  min-height: 44px; border: 2px solid var(--ink); border-radius: 12px;
  padding: 9px 13px; font-weight: 800;
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform .14s ease, box-shadow .14s ease;
  color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
}
.game-button:hover:not(:disabled) { transform: translate(-2px,-2px); box-shadow: 5px 5px 0 var(--ink); }
.game-button:active:not(:disabled) { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--ink); }
.game-button:disabled { cursor: not-allowed; opacity: .55; box-shadow: none; }
.btn-blue  { background: var(--blue); color: #fff; }
.btn-coral { background: var(--coral); }
.btn-paper { background: var(--paper); }

.gabdice-grid {
  display: grid; gap: 16px; grid-template-columns: 1fr;
  margin-top: 16px;
}
@media (min-width: 1000px) {
  .gabdice-grid { grid-template-columns: 1fr 1.08fr 1fr; }
}

.spinner-card {
  border: 3px solid var(--ink); border-radius: 22px; padding: 16px;
  min-height: 232px; box-shadow: 5px 5px 0 var(--ink); position: relative;
}
.card-feeling { background: #ffb0aa; }
.card-situation { background: #a9c4ff; }
.spinner-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.kicker { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; margin: 0; }
.kicker-blue { color: var(--blue); }
.spinner-heading {
  font-family: "Fraunces", Georgia, serif; font-size: 1.4rem;
  letter-spacing: -.05em; margin: 4px 0 0; font-weight: 800; line-height: 1;
}
.icon { flex: 0 0 auto; color: var(--ink); }

.slot-window {
  position: relative; height: 72px; margin: 12px 0;
  display: grid; place-items: center;
  border: 3px solid var(--ink); border-radius: 15px;
  background: var(--paper); overflow: hidden;
  box-shadow: inset 0 -5px 0 rgba(23,34,59,.09);
}
.slot-result {
  padding: 5px 16px; text-align: center;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(1.4rem, 2.8vw, 2.15rem); font-weight: 800;
  letter-spacing: -.04em; line-height: 1;
}
.slot-result.is-spinning { animation: slot-hop .1s linear infinite alternate; }
@keyframes slot-hop {
  from { transform: translateY(-12px); opacity: .35; }
  to   { transform: translateY(12px);  opacity: 1; }
}

.die-slot { width: 120px; height: 120px; margin: 12px auto 0; display: grid; place-items: center; }
.die-face {
  width: 120px; height: 120px; display: grid; place-items: center;
  border: 3px solid var(--ink); border-radius: 13px; background: var(--paper);
  box-shadow: 3px 3px 0 var(--ink); color: var(--coral);
  position: relative; transform-origin: center; will-change: transform, filter;
}
.die-face[hidden] { display: none; }
.die-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
  gap: 6px; padding: 12px; width: 100%; height: 100%;
}
.pip { width: 100%; aspect-ratio: 1; border-radius: 50%; background: transparent; align-self: center; justify-self: center; }
.pip.on { background: var(--coral); }
.die-face.is-rolling { animation: dice-tumble .28s ease-in-out infinite; }
.die-face.is-settling { animation: dice-settle .32s cubic-bezier(.2,.8,.25,1) both; }
@keyframes dice-tumble {
  0%   { transform: translate(0,0) rotate(-8deg) scale(.97); filter: drop-shadow(0 0 3px rgba(255,216,77,.35)); }
  25%  { transform: translate(2px,-2px) rotate(7deg) scale(1.025); filter: drop-shadow(0 0 9px rgba(255,216,77,.65)); }
  50%  { transform: translate(-2px,1px) rotate(-6deg) scale(.99); filter: drop-shadow(0 0 5px rgba(255,216,77,.45)); }
  75%  { transform: translate(1px,2px) rotate(8deg) scale(1.02); filter: drop-shadow(0 0 9px rgba(255,216,77,.6)); }
  100% { transform: translate(0,0) rotate(-8deg) scale(.97); filter: drop-shadow(0 0 3px rgba(255,216,77,.35)); }
}
@keyframes dice-settle {
  0%   { transform: rotate(5deg) scale(1.04); }
  65%  { transform: rotate(-2deg) scale(.99); }
  100% { transform: rotate(0) scale(1); }
}

.prompt-card {
  border: 3px solid var(--ink); border-radius: 24px; padding: 15px 18px;
  box-shadow: 6px 6px 0 var(--ink); text-align: center;
  background: var(--yellow); display: flex; flex-direction: column; justify-content: center; gap: 8px;
}
.prompt-label {
  display: inline-block; padding: 5px 9px; font-size: .68rem;
  background: var(--paper); color: var(--ink); font-weight: 800;
  border: 2px solid var(--ink); border-radius: 999px;
  text-transform: uppercase; letter-spacing: .08em; align-self: center;
}
.prompt-display {
  min-height: 140px;
  max-height: 140px;
  display: grid;
  place-items: center;
  margin-top: 8px;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -.04em;
  text-align: center;
  overflow: hidden;
}
.prompt-display p {
  margin: 0;
}
#prompt-text {
  font-size: 2.7rem;  /* default; JS shrinks it if needed */
  text-wrap: balance; /* avoid a lone last word wrapping onto its own line */
}
#prompt-empty {
  font-size: 2rem;
  line-height: 1.1;
  text-wrap: balance;
}
.prompt-display.has-prompt { animation: prompt-pop .28s ease both; }
@keyframes prompt-pop {
  from { transform: scale(.94) rotate(-1deg); opacity: .2; }
  to   { transform: scale(1); opacity: 1; }
}
.roll-both {
  min-height: 66px; font-size: clamp(1.05rem, 2vw, 1.45rem); letter-spacing: .05em;
  width: 100%; background: var(--ink); color: #fff; margin-top: 8px;
}
.shortcut-row-hint { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 8px; }
.shortcut-hint { font-size: .72rem; font-weight: 700; }
#game-status { min-height: 20px; font-size: .78rem; font-weight: 800; margin: 8px 0 0; }

/* ---------------------------------------------------------------------
   ROUND HISTORY CARD
   --------------------------------------------------------------------- */
.history-card {
  border: 3px solid var(--ink);
  border-radius: 20px;
  padding: 13px 15px;
  box-shadow: 5px 5px 0 var(--ink);
  background: var(--paper);
  margin-top: 16px;
}
.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.history-head h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
}
.helper {
  margin: 4px 0 0;
  font-size: .78rem;
  font-weight: 600;
}

.how-to-line {
  margin: 20px auto 0;
  max-width: 720px;
  text-align: center;
  font-size: clamp(1rem, 2vw, 1.35rem);
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink);
}

/* Round progress rail */
.progress-wrap { margin-top: 12px; }
.progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.progress-rail {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
}
.progress-marker {
  display: block;
  height: 12px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: var(--paper);
  transition: background .25s ease;
}
.progress-marker.done    { background: var(--coral); }
.progress-marker.current { background: var(--yellow); }

/* Toggle: show/hide the combined prompts log */
.history-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  font-size: .78rem;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
}
.history-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--coral);
  cursor: pointer;
}

/* Round log — completely hidden until the toggle is checked */
.round-log { display: none; }
.round-log.show-prompts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 10px;
}
@media (max-width: 800px) {
  .round-log.show-prompts { grid-template-columns: 1fr; }
}

.round-entry {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--paper);
  padding: 8px 10px;
  font-size: .78rem;
  font-weight: 700;
  line-height: 1.25;
}
.round-entry-number {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: var(--yellow);
  font-size: .66rem;
  font-weight: 800;
}
.round-entry-body { min-width: 0; flex: 1; }
.round-entry-pair { margin: 0; font-weight: 800; }
.round-entry-prompt {
  margin: 4px 0 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: .9rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--ink);
}

/* Round code — sits inside #round-log, so it inherits the toggle's visibility.
   Spans both grid columns because it is a single line, not a round. */
.round-code {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  margin-top: 2px;
  font-size: .62rem;
  font-weight: 700;
  opacity: .55;
}
.round-code-label {
  text-transform: uppercase;
  letter-spacing: .08em;
}
.round-code-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .66rem;
  font-weight: 400;
  letter-spacing: .01em;
  word-break: break-all;
  cursor: copy;
  user-select: all;
}
.round-code-value:hover { opacity: 1; }

.empty-rounds {
  grid-column: 1 / -1;
  padding: 13px;
  border: 2px dashed var(--ink);
  border-radius: 10px;
  text-align: center;
  font-size: .8rem;
  font-weight: 700;
}


.mini-button {
  width: 34px; height: 34px; display: grid; place-items: center;
  border: 2px solid var(--ink); border-radius: 9px; background: var(--paper);
  font-weight: 800; font-size: 1rem;
}
.mini-button:hover { background: var(--yellow); }

.hidden { display: none; }

/* Customize page */
.settings-panel {
  margin-top: 18px; border: 3px solid var(--ink); border-radius: 20px;
  padding: 16px; box-shadow: 5px 5px 0 var(--ink); background: #fff;
}
.settings-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.settings-head h2 { margin: 0; font-size: 1.4rem; font-weight: 800; }
.settings-grid { display: grid; grid-template-columns: 1fr; gap: 20px; margin-top: 16px; }
@media (min-width: 800px) { .settings-grid { grid-template-columns: 1fr 1fr; } }
.settings-list { display: grid; gap: 7px; margin-bottom: 8px; }
.option-editor-row {
  display: grid; grid-template-columns: 32px minmax(0,1fr) 34px 34px 34px;
  gap: 6px; align-items: center;
}
.option-order { text-align: center; font-size: .8rem; font-weight: 800; }
.option-text-input {
  width: 100%; min-height: 34px; padding: 6px 9px; border: 2px solid var(--ink);
  border-radius: 9px; background: var(--paper); font-weight: 700;
}
.customize-actions { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
#customize-status { font-weight: 800; font-size: .82rem; }

/* Upgrade / sign-in notice */
.gabdice-upgrade-notice { display: grid; place-items: center; padding: 40px 20px; }
.upgrade-card {
  max-width: 520px; padding: 24px; border: 3px solid var(--ink); border-radius: 22px;
  box-shadow: 6px 6px 0 var(--ink); background: var(--cream);
  font-family: "DM Sans", system-ui, sans-serif; color: var(--ink);
}
.upgrade-card h2 { margin: 0 0 8px; font-family: "Fraunces", Georgia, serif; font-size: 1.5rem; }
.upgrade-card ul { margin: 8px 0 16px 20px; }

@media (max-width: 500px) {
  .option-editor-row { grid-template-columns: 25px minmax(0,1fr) 30px 30px 30px; gap: 4px; }
  .mini-button { width: 30px; height: 30px; }
}
@media (max-width: 700px) {
  .round-pill {
    position: static;
    transform: none;
    margin: 8px auto;
  }
}
.signed-in-as { font-family: "DM Sans", system-ui, sans-serif; }


/* ---------------------------------------------------------------------
   EMAIL CAPTURE MODAL
   --------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(23, 34, 59, 0.68);
}
.modal-backdrop[hidden] { display: none; }
.email-modal {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  background: #fffdf8;            /* hard-coded opaque, not var() */
  border: 3px solid #17223b;
  border-radius: 22px;
  padding: 26px 24px;
  box-shadow: 8px 8px 0 #17223b;
  font-family: "DM Sans", system-ui, sans-serif;
  color: #17223b;
  text-align: center;
}
.email-modal h2 {
  margin: 0 0 8px;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.5rem;
  letter-spacing: -.03em;
  font-weight: 800;
}
.email-modal-sub {
  margin: 0 0 18px;
  font-size: .92rem;
  font-weight: 600;
  line-height: 1.4;
}
.email-modal form {
  display: grid;
  gap: 10px;
}
.email-modal input[type="email"] {
  width: 100%;
  padding: 12px 14px;
  font-size: 1rem;
  font-weight: 700;
  border: 2px solid var(--ink);
  border-radius: 12px;
  /* Tinted against the modal's #fffdf8 so the field reads as a distinct
     control rather than blending into the panel. The tint is kept in the
     focus state too: the field autofocuses when the modal opens, so the
     focused style is the one people actually see. Focus is signalled by the
     yellow ring alone. */
  background: #ece3cd;
  color: var(--ink);
  box-sizing: border-box;
}
.email-modal input[type="email"]::placeholder {
  color: #6f6759;
  font-weight: 600;
  opacity: 1;                    /* Firefox dims placeholders by default */
}
.email-modal input[type="email"]:focus {
  outline: 4px solid var(--yellow);
  outline-offset: 2px;
}
.email-modal-error {
  min-height: 1em;
  margin: 0;
  color: var(--coral);
  font-size: .8rem;
  font-weight: 800;
}
.email-modal-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 4px;
}
.email-modal-actions .game-button {
  min-width: 140px;
}
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
.email-modal-actions .game-button {
  min-height: 44px;
  border: 2px solid #17223b;
  border-radius: 12px;
  padding: 9px 16px;
  font-weight: 800;
  font-size: .9rem;
  box-shadow: 3px 3px 0 #17223b;
  cursor: pointer;
  transition: transform .14s ease, box-shadow .14s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 140px;
}
.email-modal-actions .game-button:hover:not(:disabled) {
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 #17223b;
}
.email-modal-actions .game-button:active:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 #17223b;
}
.email-modal-actions .game-button:disabled {
  cursor: not-allowed;
  opacity: .55;
  box-shadow: none;
}

/* Specific button colors */
.email-modal-actions .btn-paper {
  background: #fffdf8;
  color: #17223b;
}
.email-modal-actions .btn-blue {
  background: #2e62d3;
  color: #ffffff;
}
/* --- Email verification modal additions ----------------------------- */
.email-modal-sent-copy {
  margin: 0 0 12px;
  font-size: 1rem;
  color: #1a1a1a;
  line-height: 1.5;
}
.email-modal-sent-copy strong {
  color: #ff6b5b;
  word-break: break-all;
}
.email-modal-sent-hint {
  margin: 0 0 20px;
  font-size: 0.85rem;
  color: #666;
  line-height: 1.5;
}
.signed-in-as:empty { display: none; }
#game-status.flash {
  color: #ff6b5b;
  font-weight: 600;
  animation: statusFlash 2.5s ease-out forwards;
}
@keyframes statusFlash {
  0%   { opacity: 1; transform: translateY(0); }
  70%  { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-4px); }
}
[hidden] { display: none !important; }
/* ---------------------------------------------------------------------
   MOBILE COMPACT MODE
   Hide the Feeling / Situation cards below the desktop breakpoint. Keep the
   dice. The prompt card still shows the full question ("Tell us about your…"),
   so the result context is preserved.
   --------------------------------------------------------------------- */
@media (max-width: 999px) {
  /* Kill the big colored cards */
  .spinner-card {
    display: none;
  }

  /* Tighten the gap between the die and the prompt card */
  .gabdice-grid {
    gap: 10px;
  }

  /* Die slots: slightly smaller so both fit above the fold */
  .die-slot {
    width: 96px;
    height: 96px;
    margin: 4px auto 0;
  }
  .die-face {
    width: 96px;
    height: 96px;
  }
  .die-grid {
    gap: 5px;
    padding: 10px;
  }

  /* Prompt card: more breathing room since it's now the visual anchor */
  .prompt-card {
    padding: 18px 16px;
  }
  .prompt-display {
    min-height: 120px;
    max-height: 120px;
  }
  #prompt-empty {
    font-size: 1.6rem;
  }
}