/* Base typography + before/screen/after layout shared by every game page
   (not the landing, not the content pages). */

:root {
  --font-mono: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, monospace;
}

body {
  font-family: var(--font-mono);
  background: hsl(36, 35%, 99.4%); /* very subtle warm */
  color: black;
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 72px 20px 64px;
}

.app {
  width: 100%;
  max-width: 90vw;
  min-height: calc(100vh - 136px);
  display: grid;
  grid-template-rows: 1fr auto 1fr;
}

/* Before/After: 1fr halves, content centered. */
.before, .after {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}
.after .action-bar {
  display: flex;
  gap: 28px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

/* The middle row holds the .game-screen. auto-sized = intrinsic. */
.layout-middle {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Title (lives inside .before, vertically centered there). */
.game-title {
  font-size: clamp(28px, 6vmin, 48px);
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: center;
  margin: 0;
  padding: 0;
  border: none;
  text-transform: none;
  line-height: 1;
}

button {
  background: white;
  color: black;
  border: 1px solid black;
  padding: 10px 18px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  text-transform: lowercase;
  letter-spacing: 0.02em;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: box-shadow 0.15s ease, background 0.15s ease, color 0.15s ease;
}
button:hover:not(:disabled) {
  background: black;
  color: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.10);
}
button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  box-shadow: none;
}

/* Primary action bar — bigger, prominent center buttons (Play / Invite / Join). */
.action-bar button {
  padding: 18px 32px;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  border-radius: 5px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  min-width: 140px;
}
.action-bar button:hover:not(:disabled) {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.10);
}

textarea {
  width: 100%;
  min-height: 80px;
  border: 1px solid black;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 11px;
  margin: 6px 0 10px;
  resize: vertical;
  background: white;
  color: black;
  line-height: 1.4;
}
textarea:focus { outline: 2px solid black; outline-offset: -2px; }
textarea[readonly] { background: #fafafa; }

.row { display: flex; gap: 6px; align-items: center; }
.center { text-align: center; }
hr { border: none; border-top: 1px solid #ddd; margin: 14px 0; }

/* State-driven element visibility — set data-state on .app. */
.app[data-state="idle"]    .state-playing,
.app[data-state="idle"]    .state-lobby   { display: none !important; }
.app[data-state="lobby"]   .state-idle,
.app[data-state="lobby"]   .state-playing { display: none !important; }
.app[data-state="playing"] .state-idle,
.app[data-state="playing"] .state-lobby   { display: none !important; }


/* ===== Modal (native <dialog>) ===== */
dialog.modal-card {
  margin: auto;
  padding: 44px 28px 24px;
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  background: white;
  color: black;
  border: 1px solid black;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
  overflow-y: auto;
  text-align: left;
}
dialog.modal-card[open] {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
dialog.modal-card::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.modal-cancel {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  background: white;
  color: black;
  border: 1px solid black;
  padding: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.modal-cancel:hover { background: black; color: white; }

/* Readonly SDP textareas are click-to-copy. */
dialog.modal-card textarea {
  min-height: 56px;
  font-size: 10px;
  resize: vertical;
  margin: 0;
}
dialog.modal-card textarea[readonly] { cursor: pointer; background: #fafafa; }
dialog.modal-card textarea[readonly]:hover { background: #f3f3f3; }

/* Step action button — centered under the textarea. */
dialog.modal-card .step button {
  display: block;
  margin: 10px auto 0;
}
