@font-face {
  font-family: 'Secular One';
  src: url('/static/fonts/SecularOne-Regular.ttf') format('truetype');
  font-display: swap;
}

@font-face {
  font-family: 'Borel';
  src: url('/static/fonts/Borel-Regular.ttf') format('truetype');
  font-display: swap;
}

@font-face {
  font-family: 'Roboto';
  src: url('/static/fonts/Roboto-Regular.ttf') format('truetype');
  font-display: swap;
}

@font-face {
  font-family: 'DSEG7';
  src: url('/static/fonts/DSEG7Classic-Bold.ttf') format('truetype');
  font-display: swap;
}

@font-face {
  font-family: 'Bebas Neue';
  src: url('/static/fonts/BebasNeue-Regular.ttf') format('truetype');
  font-display: swap;
}

:root {
  --color-bg: #afafaf;
  --color-card-bg: #00a0b8;
  --color-loop-1: #ad204a;
  --color-loop-2: #ff9b45;
  --color-loop-3: #fed348;
  --color-loop-4: #fee596;
  --color-player-bg: #fee596;
  --color-player-border: #dd2330;
  --color-button-hover: #525252;
  --color-text-dark: #1b110f;
  --color-text-light: #ffffff;
  --color-text-muted: #f0f0f0;
  --color-shadow: rgba(0, 0, 0, 0.25);
  --color-dim: rgba(0, 0, 0, 0.3);
  --color-backdrop: rgba(0, 0, 0, 0.5);

  --font-display: 'Secular One', sans-serif;
  --font-script: 'Borel', cursive;
  --font-score: 'DSEG7', monospace;
  --font-body: 'Roboto', sans-serif;
  --font-title: 'Bebas Neue', 'Secular One', sans-serif;
}


/* reset */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
}

body {
  font-family: var(--font-display);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding: 1em;
  gap: 1em;
  background: var(--color-card-bg) url('/static/img/card-bg.svg') center / auto 100% no-repeat;
  color: var(--color-text-light);
  max-width: 75vw;
  margin: 0 auto;
}

@media (max-width: 500px) {
  body {
    max-width: 100%;
  }
}

ul,
ol {
  list-style: none;
  padding: 0;
}

input,
select,
textarea {
  background: var(--color-text-light);
  color: var(--color-text-dark);
  border: 4px solid var(--color-text-dark);
  border-radius: 1em;
  padding: .5em 1em;
  font: inherit;
}

input::placeholder {
  color: var(--color-text-dark);
  opacity: .5;
}

a {
  color: var(--color-loop-1);
  text-decoration: none;
}

/* utility classes */
.script {
  font-family: var(--font-script);
}

.score-font {
  font-family: var(--font-score);
}

/* primitives */
.stack {
  display: flex;
  flex-direction: column;
  gap: .75em;
}

.stack-centered {
  align-items: center;
  text-align: center;
}

#invite-dialog {
  max-width: 90vw;
}

#invite-qr {
  width: 100%;
  max-width: 20em;
  height: auto;
}

.invite-link {
  word-break: break-all;
  font-family: monospace;
  font-size: 1.25em;
  text-decoration: none;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75em;
}

/* buttons (shared base) */
.button,
.button-teal,
.button-danger,
.button-create,
.button-action {
  border: none;
  border-radius: 1em;
  font: inherit;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 .25em .25em var(--color-shadow);
}

.button {
  background: var(--color-text-dark);
  color: var(--color-text-light);
  padding: .6em 1em;
  text-transform: uppercase;
  letter-spacing: .05em;
  text-decoration: none;
}

.button:hover {
  background: var(--color-button-hover);
  color: var(--color-text-light);
}

.button-teal {
  background: var(--color-card-bg);
  color: var(--color-text-light);
  padding: .75em 2em;
}

.button-teal:hover {
  filter: brightness(1.1);
}

.button-danger {
  background: var(--color-player-border);
  color: var(--color-text-light);
  padding: .75em 2em;
}

.button-create {
  background: var(--color-text-dark);
  color: var(--color-loop-2);
  padding: .5em 1.5em;
  font-size: 1em;
  text-transform: uppercase;
  align-self: center;
}

.button-create:hover {
  background: var(--color-button-hover);
}

/* larger variant for the primary create-game call-to-action */
.button-create.button-create-lg {
  padding: .6em 2em;
  font-size: 1.3em;
}

.button-action {
  background: var(--color-text-dark);
  color: var(--color-text-light);
  padding: .75em 2em;
}

.button-action:hover {
  background: var(--color-button-hover);
}

/* game card (layout container, no visual chrome) */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  align-items: center;
  gap: 1em;
  width: 100%;
  flex: 1;
}

.card > * {
  position: relative;
  z-index: 1;
}

.card-float {
  width: 100%;
  flex: 1;
  display: flex;
}

/* join screen: logo at top, form centered in remaining space */
.card-join {
  justify-content: flex-start;
  padding-top: 1.5em;
}

.card-join .join-group {
  margin-top: auto;
  margin-bottom: auto;
}

/* in-game variant of .card */
.card-game {
  justify-content: flex-start;
  align-items: stretch;
  padding: .25em;
  padding-top: 1.5em;
  overflow-y: auto;
}

.card-game::after {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--color-dim);
  z-index: 0;
  pointer-events: none;
}

.player-dimmed {
  filter: brightness(0.7);
}

/* empty sections (e.g. the table during the invite lobby) shouldn't take up a
   flex gap and push later content down -- collapse them when they have no
   content so the spacing stays even. */
#points:empty {
  display: none;
}

/* card logo (join screen standalone) */
.card-logo {
  background: var(--color-text-dark);
  color: var(--color-text-light);
  font-family: var(--font-script);
  font-size: 3em;
  padding: 1.25em 1em .5em;
  border-radius: .5em;
  text-align: center;
  box-shadow: 0 .25em .25em var(--color-shadow);
}

/* layout regions */
.site-footer {
  position: relative;
  z-index: 1;
  width: 100%;
  text-align: center;
  color: var(--color-text-light);
  padding: 0 1em;
  margin-top: auto;
}

.site-footer-meta {
  display: block;
  font-size: 0.9rem;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9), 0 0 2px rgba(0, 0, 0, 0.8);
}

.site-footer-version {
  display: block;
  font-size: 0.65rem;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9), 0 0 2px rgba(0, 0, 0, 0.8);
  margin-top: .25em;
}

#help-dialog {
  max-width: 32em;
}

.help-list {
  list-style: none;
  padding-left: 1.25em;
}

.help-list li {
  position: relative;
  margin: .35em 0;
}

.help-list li::before {
  content: "§";
  position: absolute;
  left: -1.25em;
  color: var(--color-loop-1);
}

/* about/rules/getting started shown on the create screen */
.help-intro {
  max-width: 28em;
  text-align: left;
  background: var(--color-text-light);
  border: 10px solid var(--color-text-dark);
  color: var(--color-text-dark);
  padding: 1.25em 1.5em;
  border-radius: 2.2em;
  box-shadow: 0 .25em .25em var(--color-shadow);
}

.help-intro h3 {
  margin-top: .25em;
}

.input-wrap {
  position: relative;
}

.input-wrap input {
  width: 100%;
  padding-right: 2.5em;
}

.info-toggle {
  position: absolute;
  right: .75em;
  top: 50%;
  transform: translateY(-50%);
  width: 1.4em;
  height: 1.4em;
  border: 2px solid var(--color-button-hover);
  border-radius: 50%;
  background: none;
  color: var(--color-button-hover);
  font-style: italic;
  font-weight: bold;
  font-size: .6em;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

.info-bubble {
  display: none;
  position: absolute;
  top: calc(100% + .5em);
  left: 0;
  right: 0;
  background: var(--color-text-light);
  color: var(--color-text-dark);
  border: 4px solid var(--color-text-dark);
  border-radius: 1em;
  padding: .5em .75em;
  font-size: .75em;
  z-index: 10;
}

.info-bubble[aria-hidden="false"] {
  display: block;
}


.site-footer a,
.site-footer a:visited,
.site-footer-link {
  color: var(--color-text-muted);
}

.site-footer-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  text-shadow: inherit;
  cursor: pointer;
  text-decoration: none;
}

.site-footer a {
  text-decoration: none;
}

.site-footer a:hover,
.site-footer-link:hover {
  color: var(--color-loop-2);
}

.card-action {
  flex: 1 1 0;
  min-width: 0;
  font-size: 1.25em;
  font-weight: bold;
  text-transform: uppercase;
  text-align: center;
  padding: .75em .5em;
  color: var(--color-loop-2);
}

#start {
  color: var(--color-card-bg);
}

#start:hover {
  color: var(--color-text-light);
}


.game-title {
  width: 100%;
  align-items: center;
}

/* combined game header card */
.game-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5em;
  width: 100%;
  max-width: 30em;
  align-self: center;
  background: var(--color-text-light);
  color: var(--color-text-dark);
  border: .5em solid var(--color-text-dark);
  border-radius: .9em;
  padding: 0 .75em .75em;
  box-shadow: 0 .25em .25em var(--color-shadow);
  text-align: center;
  overflow: hidden;
}

.header-logo {
  font-family: var(--font-script);
  font-size: 2.5em;
  line-height: 1;
  background: var(--color-text-dark);
  color: var(--color-text-light);
  width: calc(100% + 1.5em);
  margin: 0 -.75em;
  padding: 1em .5em .2em;
}

.game-header footer {
  font-family: var(--font-script);
  font-size: .875em;
  font-weight: 600;
}

#status-fetch {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.game-header footer.status {
  padding: .7em .5em .25em;
  background: var(--color-text-dark);
  color: var(--color-text-light);
  font-family: var(--font-script);
  border: none;
  border-radius: .3em;
  font-size: .7em;
  line-height: 1.4;
}

.game-header footer.playing-as,
.game-header footer.initiative {
  font-family: sans-serif;
  font-size: .875em;
}

.game-header footer.playing-as {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: .25em;
}

.game-header footer.playing-as #self {
  font-size: 2.25em;
  font-weight: 900;
  line-height: 1;
}

.role-label {
  font-style: italic;
  color: var(--color-button-hover);
}

/* player pill */
.player {
  position: relative;
  background: var(--color-loop-2);
  border: .8em solid var(--color-player-border);
  border-radius: 6em;
  padding: 1.25em 1em;
  min-height: 12em;
  width: 100%;
}
.player.active-turn {
  background: var(--color-player-bg);
  outline: .25em dotted var(--color-text-light);
  outline-offset: -.5em;
}

.player .player-name {
  position: absolute;
  bottom: -.5em;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-text-light);
  color: var(--color-text-dark);
  border: .2em solid var(--color-text-dark);
  border-radius: .3em;
  padding: 0 .5em;
  font-size: .75em;
  line-height: 1.8;
  white-space: nowrap;
  z-index: 2;
}

.player-score {
  position: absolute;
  top: -.5em;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-text-dark);
  border: .2em solid var(--color-loop-3);
  border-radius: .25em;
  padding: 0 .5em 0 .5em;
  min-width: 4em;
  text-align: right;
  font-family: var(--font-score);
  font-size: 1em;
  color: var(--color-player-border);
  line-height: 1.75;
  box-shadow: .125em .125em .125em var(--color-shadow);
  z-index: 2;
}

.player-rules {
  margin-top: 1em;
  margin-bottom: .75em;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .5em;
}

/* shared boxed card: 6x4 index-card proportions, used in the player pill
   and the game log so cards look the same everywhere */
.index-card {
  aspect-ratio: 6 / 4;
  width: 6.75em;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: .25em;
  background: var(--color-text-light);
  color: var(--color-text-dark);
  border: .1em solid var(--color-text-dark);
  border-radius: .4em;
  box-shadow: .1em .1em .15em var(--color-shadow);
  font-family: var(--font-title);
  font-size: 1.33em;
  line-height: 1.05;
  text-transform: uppercase;
  letter-spacing: .02em;
  overflow: hidden;
}

/* modifier cards read as the action card stock */
.index-card-modifier {
  background: var(--color-card-bg);
  color: var(--color-text-light);
}

/* clickable rule cards for accusing */
.index-card-accuse {
  cursor: pointer;
}

.index-card-accuse:hover {
  border-color: var(--color-loop-1);
  box-shadow: 0 0 0 .15em var(--color-loop-1);
}


/* action popup (spin, destroy, points, etc.) */
.action-popup {
  background: var(--color-text-light);
  border: .625em solid var(--color-text-dark);
  border-radius: 2.2em;
  padding: 1.5em;
  box-shadow: .25em .25em .25em var(--color-shadow);
  text-align: center;
  max-width: 15.7em;
  margin: .75em auto;
}

.action-popup h2 {
  color: var(--color-text-dark);
  font-size: 1.5625em;
  margin-bottom: .5em;
}

/* points selector */
.points-selector {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5em;
}

.points-selector .value {
  font-family: var(--font-display);
  font-size: 2em;
  color: var(--color-text-dark);
  min-width: 2em;
  text-align: center;
}

.points-selector {
  margin-bottom: .75em;
}

.points-selector button {
  background: var(--color-text-dark);
  color: var(--color-text-light);
  border: none;
  border-radius: .3em;
  width: 2.25em;
  height: 2.25em;
  font-size: 1.25em;
  cursor: pointer;
}

/* dialogs */
dialog {
  border: .625em solid var(--color-text-dark);
  border-radius: 2.2em;
  padding: 1.5em;
  background: var(--color-text-light);
  color: var(--color-text-dark);
  box-shadow: .25em .25em .25em var(--color-shadow);
  max-width: 18.75em;
  margin: auto;
}

dialog::backdrop {
  background: var(--color-backdrop);
}

.decide-info-rule {
  font-family: var(--font-script);
}

dialog h2 {
  font-size: 1.5625em;
  text-align: center;
  margin-bottom: .75em;
}

dialog .button,
dialog .button-teal,
dialog .button-danger {
  width: 100%;
  text-align: center;
}

#points-amount {
  margin-bottom: .75em;
}

dialog fieldset {
  border: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .75em;
  margin-bottom: 1em;
}

.accuse-option {
  display: flex;
  align-items: center;
  gap: .5em;
  padding: .5em;
  cursor: pointer;
}

.accuse-option:hover {
  background: var(--color-dim);
}

.accuse-option:has(input:checked) {
  background: var(--color-backdrop);
}

/* table bar (inside header card) */
.table-bar {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .75em;
  padding: .5em 0 .25em;
  width: 100%;
}

.table-bar button {
  min-width: 8em;
}

.table-bar button:disabled {
  opacity: .35;
  cursor: not-allowed;
  filter: grayscale(.5);
}

/* points section (centered in card) */
.game-points {
  align-items: center;
  margin-top: auto;
}

/* game-over screen */
.game-over {
  gap: 1em;
  padding: 1em 0 2em;
}
.game-over-winner {
  font-family: var(--font-display);
  font-size: 1.5em;
  text-align: center;
}
.game-over-standings {
  list-style: none;
  width: 100%;
  max-width: 20em;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .5em;
}
.game-over-standings li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: .4em .9em;
  border-radius: .3em;
  background: var(--color-loop-2);
  color: var(--color-text-dark);
}
.game-over-standings li:first-child {
  background: var(--color-player-bg);
}
.game-over-score {
  font-family: var(--font-score);
}

/* event log: the status line becomes the live event feed once play starts */

/* before the first event (pre-game): plain status. after: the live line. */
.status-live {
  display: none;
}
.game-header:has(.event) #status-fetch {
  display: none;
}
.game-header:has(.event) .status-live {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4em;
}

/* the history button beside the live line */
.button-more {
  flex: none;
  padding: .7em .5em .25em;
  background: var(--color-text-dark);
  color: var(--color-text-light);
  font-family: var(--font-script);
  border: none;
  border-radius: .3em;
  font-size: .7em;
  line-height: 1.4;
  cursor: pointer;
}

.event-log {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column; /* oldest first; newest at the bottom */
  gap: .15em;
}
.event {
  padding: .3em .5em;
  border-bottom: .1em solid var(--color-player-border);
  font-size: .9em;
}

/* in the full log, stack the message above its card */
#event-log-full .event {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .4em;
}

/* inline: just the newest event (the last item); hide the rest */
.event-log-live {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}
.event-log-live .event:not(:last-child) {
  display: none;
}
.event-log-live .event {
  padding: 0 .3em;
  border: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: .85em;
  line-height: 1.3;
  animation: fade-in .4s ease;
}
/* the inline ticker is one line; cards only show in the full log */
.event-log-live .index-card-log {
  display: none;
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* expanded log: last ~6 events, newest at the bottom, older fading out on top */
#event-log-dialog {
  width: 75vw;
  height: 75vh;
  max-width: 75vw;
}
#event-log-dialog .dialog-body {
  height: 100%;
}
#event-log-full {
  min-width: 16em;
  flex: 1 1 auto; /* fill the tall dialog; scroll up for older */
  overflow-y: auto;
  overscroll-behavior: contain; /* keep iOS from scrolling the page behind */
  -webkit-overflow-scrolling: touch;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, black 2.5em);
  mask-image: linear-gradient(to bottom, transparent 0, black 2.5em);
}


