/* Dice Brawl: Unfold the Dungeon - screens, menus, buttons, overlays. */

/* [ZeroLabs] 2026-11-01: the ZeroLabs splash at launch, the same as ColorBrawl's (Zero). */
#splash {
  position: fixed;
  inset: 0;
  background: #0A0A1A;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 9999;
}

#splash-tagline {
  color: #64ffda;
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 300;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  text-indent: 0.4em;
  opacity: 0;
}

#splash-logo {
  width: 100px;
  height: 100px;
  color: #64ffda;
  opacity: 0;
  transition: opacity 0.3s;
}

#splash-logo svg {
  width: 100%;
  height: 100%;
  fill: none;
  display: block;
}

#splash-logo #B { opacity: 0; }

:root {
  --bg: #12141a;
  --surface: #1c1f27;
  --surface-raised: #252935;
  --border: #343a48;
  --text: #e8eaf0;
  --text-dim: #9aa1b2;
  --accent: #6c8cff;
  --danger: #e0565b;
  --player-0: #e5484d;
  --player-1: #3b82f6;
  --inset: inset 0 1px 0 rgba(255, 255, 255, 0.08), inset 1px 0 0 rgba(255, 255, 255, 0.04), inset -1px 0 0 rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  /* The game fills the screen. The panel scrolls on its own, and the tilted board must not scroll the page. */
  overflow: hidden;
  /* [ZeroLabs] 2026-11-01: no pull-to-refresh on a phone (Zero: a reload lost a whole match). A swipe
     down at the top of the page no longer reloads it. */
  overscroll-behavior: none;
}

.hidden {
  display: none !important;
}

.screen {
  height: 100%;
}

/* ---------- Buttons ---------- */

.btn {
  font: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--inset);
}

.btn:hover:not(:disabled) {
  border-color: var(--accent);
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #0b0d12;
  font-weight: 600;
}

.btn-small {
  font-size: 13px;
  padding: 6px 10px;
}

/* ---------- Menu ---------- */

/* [ZeroLabs] 2026-11-02: (Zero: reuse ColorBrawl's scaffolding) the menu is ColorBrawl's app shell:
   a rounded top bar, the tab screens (each scrolls on its own), and a rounded bottom bar, with
   ColorBrawl's inset-edged panels, in Dice Brawl's colors. js/menu.js switches the tabs. */
#screen-menu.menu-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.menu-topbar,
.menu-bottombar {
  flex-shrink: 0;
  margin: 6px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--inset);
  display: flex;
  align-items: center;
}

.menu-topbar {
  margin-top: calc(6px + env(safe-area-inset-top));
  height: 56px;
  padding: 0 10px;
  gap: 8px;
}

.player-badge {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  padding: 4px;
}

.player-avatar {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #0b0d12;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-avatar-large {
  width: 64px;
  height: 64px;
  font-size: 28px;
}

.player-badge-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.menu-topbar-title {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}

.menu-topbar-title .menu-title-main {
  font-size: 20px;
  font-weight: 800;
}

.menu-topbar-title .menu-title-sub {
  font-size: 10px;
  margin-top: 2px;
}

.menu-topbar-icons {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  justify-content: flex-end;
  gap: 2px;
}

.menu-icon-btn,
.menu-nav-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font: inherit;
}

.menu-icon-btn {
  width: 36px;
  height: 36px;
  padding: 6px;
  border-radius: 10px;
}

.menu-icon-btn svg,
.menu-nav-btn svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: currentColor;
}

/* Lines in an icon (the envelope's fold) and holes cut out of a shape (the die's pips). */
.menu-icon-btn .icon-line {
  fill: none;
  stroke: var(--surface);
  stroke-width: 1.6;
  stroke-linejoin: round;
}

.menu-nav-btn .icon-cut {
  fill: var(--surface);
}

.menu-icon-btn:hover,
.menu-nav-btn:hover {
  color: var(--text);
}

/* [ZeroLabs] 2026-11-02: ColorBrawl's own icon images (Zero), at ColorBrawl's sizes. */
.menu-icon-img {
  display: block;
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.menu-icon-img.icon-friends {
  width: 20px;
  height: 20px;
  margin: 2px;
}

/* The calendar art has a black background: the screen blend drops it on the dark bar. */
.menu-icon-img.icon-daily {
  width: 28px;
  height: 28px;
  margin: -2px;
  mix-blend-mode: screen;
}

.nav-icon-img {
  display: block;
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.nav-icon-img.icon-play {
  width: 36px;
  height: 36px;
  margin: -3px 0;
}

.menu-nav-btn:not(.active) .nav-icon-img {
  opacity: 0.7;
}

/* ColorBrawl's match buttons: the art is the whole button. */
.option-card.match-card {
  padding: 0;
  background: none;
  border: none;
  box-shadow: none;
  border-radius: 0;
}

.option-card.match-card:hover {
  opacity: 0.85;
}

.match-btn-img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.menu-tabs {
  flex: 1;
  min-height: 0;
  position: relative;
}

.menu-tab {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.menu-tab-body {
  max-width: 700px;
  margin: 0 auto;
  padding: 10px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.menu-bottombar {
  margin-bottom: calc(6px + env(safe-area-inset-bottom));
  height: 62px;
}

.menu-nav-btn {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 12px;
  font-weight: 600;
}

.menu-nav-btn svg {
  width: 26px;
  height: 26px;
}

.menu-nav-btn.active {
  color: var(--accent);
}

/* ColorBrawl's panels: a raised rounded box with an inset top edge. */
.shell-section {
  background: var(--surface);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--inset);
}

.section-title {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-dim);
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.option-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 18px 8px;
  min-width: 0;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  box-shadow: var(--inset);
  text-align: center;
}

.option-card:hover {
  border-color: var(--accent);
}

.option-name {
  font-size: 16px;
  font-weight: 700;
}

.option-sub {
  font-size: 12px;
  color: var(--text-dim);
}

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  padding: 12px 2px;
  cursor: pointer;
  text-align: left;
}

.settings-row:last-child {
  border-bottom: none;
}

.row-arrow {
  color: var(--text-dim);
  font-size: 20px;
}

.coming-soon {
  margin: 0;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.45;
}

.profile-hero {
  flex-direction: row;
  align-items: center;
  gap: 14px;
}

.profile-identity {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.profile-name {
  font-size: 18px;
  font-weight: 700;
}

.profile-note {
  font-size: 13px;
  color: var(--text-dim);
}

.credit-row {
  text-align: left;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.credit-row:last-child {
  border-bottom: none;
}

.credit-what {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.credit-who {
  font-size: 14px;
  margin-top: 2px;
}

.credit-license {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

.menu-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(360px, 100%);
  text-align: center;
}

/* [ZeroLabs] 2026-10-27: "Dice Brawl" large, "Unfold the Dungeon" smaller under it (Zero's new
   title). Each line stays on one line. */
.menu-title {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  white-space: nowrap;
}

.menu-title-main {
  font-size: clamp(30px, 10vw, 46px);
}

.menu-title-sub {
  font-size: clamp(16px, 5vw, 22px);
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}

.menu-subtitle {
  margin: 0 0 12px;
  color: var(--text-dim);
}

/* [ZeroLabs] 2026-11-02: the loading screen of a resumed match covers everything until the match is
   preloaded, then fades out (app.js hideLoadingScreen, LOADING_FADE_MS). */
.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--bg);
  opacity: 1;
  transition: opacity 0.35s ease;
}

.loading-screen.fading {
  opacity: 0;
}

.loading-screen .loading-spinner {
  width: 34px;
  height: 34px;
  border-width: 3px;
}

.loading-text {
  color: var(--text-dim);
  font-size: 15px;
  letter-spacing: 0.04em;
}

/* [ZeroLabs] 2026-11-02: the tutorial cards, ColorBrawl's card overlay in Dice Brawl's colors. */
.tut-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(5, 6, 12, 0.88);
  backdrop-filter: blur(6px);
}

.tut-card {
  position: relative;
  width: 100%;
  max-width: 360px;
  padding: 28px 24px 22px;
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--inset);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.tut-skip {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: none;
  color: var(--text-dim);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  padding: 2px 6px;
}

.tut-title {
  font-size: 20px;
  font-weight: 800;
  text-align: center;
}

.tut-visual {
  width: 100%;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* [ZeroLabs] 2026-11-02: the text takes the spare height of a shorter card (every card is as tall as
   the tallest, tutorial.js fitTutorialHeight), so the dots and Back / Next stay in one place. */
.tut-body {
  flex: 1;
  font-size: 14px;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.55;
}

.tut-crests {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* A crest icon is 1.4em wide, and its level number scales with it, so the font size sizes both. */
.tut-crests .crest-icon {
  font-size: 32px;
  border-radius: 8px;
}

.tut-heart {
  width: 40px;
  height: 40px;
  fill: #e0263a;
}

/* [ZeroLabs] 2026-11-02: the crack of a broken heart, in the card's color (the turn card's crack). */
.tut-heart .tut-heart-crack {
  fill: none;
  stroke: var(--surface);
  stroke-width: 1.6;
  stroke-linejoin: round;
}

/* A die unfolded into a cross of 6 path tiles, on a tile of the player's own path. */
/* [ZeroLabs] 2026-11-02: sideways (Zero): 5 tiles wide, 3 high. */
.tut-net {
  display: grid;
  grid-template-columns: repeat(5, 22px);
  grid-template-rows: repeat(3, 22px);
  gap: 3px;
}

.tut-net-cell {
  border-radius: 4px;
  background: var(--player-0);
}

.tut-net-path {
  background: color-mix(in srgb, var(--player-0) 45%, var(--surface-raised));
}

.tut-dots {
  display: flex;
  gap: 6px;
}

.tut-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border);
}

.tut-dot.active {
  background: var(--accent);
}

.tut-nav {
  display: flex;
  gap: 10px;
  width: 100%;
}

.tut-btn {
  flex: 1;
  padding: 11px;
  border-radius: 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: none;
}

.tut-back {
  background: var(--surface-raised);
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.tut-next {
  background: var(--accent);
  color: #0b0d12;
}

/* [ZeroLabs] 2026-11-02: the guide frame covers the whole screen, over the menu. */
.guide-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--bg);
}

.guide-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ---------- Overlay ---------- */

.overlay {
  position: fixed;
  inset: 0;
  /* Solid, so the next player cannot see the board before tapping Ready. */
  background: #0b0c10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}

.overlay-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  width: min(380px, 100%);
  text-align: center;
  box-shadow: var(--inset);
}

.overlay-title {
  font-size: 22px;
  font-weight: 700;
  white-space: nowrap;
}

.overlay-text {
  color: var(--text-dim);
}
