@import url("https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&display=swap");

:root {
  --midnight: #0f1730;
  --steel: #1e2a4a;
  --steel-2: #24365f;
  --blue: #1ea7ff;
  --red: #ff3b30;
  --orange: #ff7a00;
  --yellow: #ffc928;
  --white: #f7faff;
  --gray: #aeb9cc;
  --green: #3dff8a;
  --magenta: #d84dff;
  --black: #070b16;
  --ink: #10172d;
  --paper: #f4f0df;
  --paper-2: #fff8df;
  --shadow: rgba(0, 0, 0, 0.34);
  --panel-border: rgba(174, 185, 204, 0.24);
  --glow-blue: 0 0 22px rgba(30, 167, 255, 0.55);
  --glow-red: 0 0 22px rgba(255, 59, 48, 0.55);
  --glow-green: 0 0 22px rgba(61, 255, 138, 0.42);
  --font-ui: "Fredoka", system-ui, sans-serif;
  --font-display: "Fredoka", system-ui, sans-serif;
  --font-manual: "Courier New", Courier, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  color: var(--white);
  font-family: var(--font-ui);
  background:
    radial-gradient(circle at 16% 12%, rgba(126, 207, 229, 0.18), transparent 34%),
    radial-gradient(circle at 86% 24%, rgba(200, 141, 217, 0.13), transparent 36%),
    linear-gradient(180deg, #101827 0%, #172033 52%, #101827 100%);
  overflow-x: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  color: inherit;
}

.app {
  min-height: 100vh;
}

.screen {
  min-height: 100vh;
  padding: 24px;
  animation: screenIn 220ms ease-out;
}

@keyframes screenIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.screen.menu-screen {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  text-align: center;
  overflow: hidden;
}

.screen.menu-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(9, 14, 26, 0.18), rgba(9, 14, 26, 0.78)),
    radial-gradient(circle at 50% 20%, rgba(247, 250, 255, 0.08), transparent 34%);
  pointer-events: none;
}

.menu-scene {
  position: absolute;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  background: linear-gradient(180deg, #172033, #101827);
}

.menu-scene canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.menu-main {
  position: relative;
  z-index: 1;
  width: min(980px, 100%);
  display: grid;
  justify-items: center;
  gap: 22px;
  padding-top: 20px;
}

.logo-wrap {
  min-height: 170px;
  display: grid;
  place-items: center;
}

.game-logo {
  width: min(680px, 88vw);
  max-height: 260px;
  object-fit: contain;
  filter: drop-shadow(0 22px 34px rgba(0, 0, 0, 0.45));
}

.fallback-title {
  display: none;
  margin: 0;
  color: var(--white);
  font-family: var(--font-display);
  font-size: clamp(3rem, 10vw, 7rem);
  line-height: 0.95;
  text-shadow: 0 6px 0 rgba(0, 0, 0, 0.34), 0 0 34px rgba(30, 167, 255, 0.7);
}

.tagline {
  margin: 0;
  color: var(--gray);
  font-size: clamp(1rem, 2vw, 1.25rem);
  max-width: 740px;
}

.menu-actions,
.join-actions,
.lobby-actions,
.end-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.credit {
  position: relative;
  z-index: 1;
  margin: 0;
  color: rgba(247, 250, 255, 0.72);
  font-size: 0.92rem;
  letter-spacing: 0;
}

.top-actions {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 20;
  display: flex;
  gap: 8px;
  align-items: center;
}

.music-control {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  border: 1px solid rgba(174, 185, 204, 0.22);
  border-radius: 8px;
  padding: 5px;
  background: rgba(7, 11, 22, 0.48);
}

.volume-wrap {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  color: var(--gray);
  font-size: 0.78rem;
  user-select: none;
}

.volume-slider {
  width: 92px;
  accent-color: var(--blue);
}

.btn {
  min-height: 44px;
  border: 1px solid rgba(247, 250, 255, 0.16);
  border-radius: 8px;
  padding: 11px 16px;
  background: linear-gradient(180deg, rgba(36, 54, 95, 0.95), rgba(20, 30, 58, 0.95));
  color: var(--white);
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(247, 250, 255, 0.11);
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease, filter 140ms ease;
  user-select: none;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: rgba(30, 167, 255, 0.55);
  box-shadow: 0 16px 28px rgba(0, 0, 0, 0.28), var(--glow-blue);
}

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

.btn.primary {
  border-color: rgba(30, 167, 255, 0.75);
  background: linear-gradient(180deg, #2fc0ff, #157bd0);
  box-shadow: 0 12px 24px rgba(30, 167, 255, 0.28), inset 0 1px 0 rgba(247, 250, 255, 0.35);
}

.btn.danger {
  border-color: rgba(255, 59, 48, 0.76);
  background: linear-gradient(180deg, #ff655a, #c91e16);
  box-shadow: 0 12px 24px rgba(255, 59, 48, 0.25), inset 0 1px 0 rgba(247, 250, 255, 0.28);
}

.btn.orange {
  border-color: rgba(255, 201, 40, 0.55);
  background: linear-gradient(180deg, #ffad22, #e66000);
}

.btn.ghost {
  background: rgba(15, 23, 48, 0.62);
}

.btn.icon {
  min-width: 44px;
  width: 44px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}

.btn.small {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 0.88rem;
}

.btn.active,
.btn.selected {
  border-color: var(--yellow);
  box-shadow: 0 0 0 2px rgba(255, 201, 40, 0.16), 0 12px 26px rgba(255, 122, 0, 0.22);
}

.btn.solved {
  border-color: var(--green);
  box-shadow: var(--glow-green);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.panel {
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(36, 54, 95, 0.92), rgba(15, 23, 48, 0.92));
  box-shadow: 0 18px 36px var(--shadow), inset 0 1px 0 rgba(247, 250, 255, 0.07);
}

.panel-inner {
  padding: 18px;
}

.connect-screen,
.lobby-screen,
.end-screen {
  display: grid;
  place-items: center;
}

.connect-card,
.lobby-card,
.end-card {
  width: min(900px, 100%);
}

.wide-card {
  width: min(1180px, 100%);
}

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

.section-title {
  margin: 0 0 12px;
  color: var(--white);
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: 0;
}

.muted {
  color: var(--gray);
}

.code-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 150px;
  min-height: 54px;
  padding: 8px 18px;
  border: 1px solid rgba(255, 201, 40, 0.5);
  border-radius: 8px;
  color: var(--yellow);
  background: rgba(255, 201, 40, 0.08);
  font-family: "Consolas", "Courier New", monospace;
  font-size: 1.7rem;
  letter-spacing: 0.1em;
}

.input-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.text-input,
.search-input,
.note-area {
  width: 100%;
  border: 1px solid rgba(174, 185, 204, 0.35);
  border-radius: 8px;
  background: rgba(7, 11, 22, 0.54);
  color: var(--white);
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.text-input,
.search-input {
  min-height: 44px;
  padding: 10px 12px;
}

.text-input:focus,
.search-input:focus,
.note-area:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(30, 167, 255, 0.15);
}

.role-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  border: 1px solid rgba(174, 185, 204, 0.28);
  border-radius: 999px;
  padding: 5px 10px;
  background: rgba(7, 11, 22, 0.32);
  color: var(--gray);
  font-size: 0.88rem;
}

.player-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0;
}

.buddy-card-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.buddy-card {
  display: grid;
  gap: 4px;
  border: 1px solid rgba(174, 185, 204, 0.24);
  border-radius: 8px;
  padding: 12px;
  background: rgba(7, 11, 22, 0.38);
}

.buddy-card strong {
  color: var(--white);
  font-size: 1.1rem;
}

.buddy-card span {
  color: var(--gray);
}

.buddy-card.ready {
  border-color: rgba(61, 255, 138, 0.35);
}

.role-card-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.role-choice-card {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(174, 185, 204, 0.24);
  border-radius: 8px;
  padding: 14px;
  background: rgba(7, 11, 22, 0.34);
}

.role-choice-card.selected {
  border-color: var(--yellow);
  box-shadow: 0 0 0 2px rgba(255, 201, 40, 0.14);
}

.role-choice-card h3,
.role-choice-card p {
  margin: 0;
}

.status-pill.good {
  border-color: rgba(61, 255, 138, 0.42);
  color: var(--green);
}

.status-pill.warn {
  border-color: rgba(255, 201, 40, 0.48);
  color: var(--yellow);
}

.difficulty-row,
.role-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.mission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.mission-card,
.check-card,
.custom-field {
  border: 1px solid rgba(174, 185, 204, 0.22);
  border-radius: 8px;
  background: rgba(7, 11, 22, 0.34);
}

.mission-card {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.mission-card h2 {
  margin: 0 0 4px;
}

.mission-card.completed {
  border-color: rgba(61, 255, 138, 0.42);
  box-shadow: var(--glow-green);
}

.mission-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mission-select-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 170px;
  overflow: auto;
  padding-right: 4px;
}

.custom-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.custom-field {
  display: grid;
  gap: 7px;
  padding: 10px;
}

.custom-field > span {
  color: var(--gray);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.module-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.check-card,
.check-field {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 10px;
}

.check-card.selected {
  border-color: var(--blue);
  box-shadow: var(--glow-blue);
}

.loading-card {
  text-align: center;
  display: grid;
  gap: 8px;
}

.game-screen {
  min-height: 100vh;
  padding: 14px;
}

.game-shell {
  min-height: calc(100vh - 28px);
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
}

.hud {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
}

.hud-main {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.timer {
  min-width: 138px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255, 201, 40, 0.86);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--yellow);
  background: rgba(7, 11, 22, 0.82);
  font-family: "Consolas", "Courier New", monospace;
  font-size: clamp(1.45rem, 4vw, 2.2rem);
  line-height: 1;
  box-shadow: 0 0 18px rgba(255, 201, 40, 0.18);
}

.timer.warning {
  color: var(--red);
  border-color: var(--red);
  animation: pulseRed 620ms ease-in-out infinite alternate;
}

@keyframes pulseRed {
  from {
    box-shadow: 0 0 12px rgba(255, 59, 48, 0.22);
  }
  to {
    box-shadow: 0 0 28px rgba(255, 59, 48, 0.65);
  }
}

.strike-box {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
}

.strike-dot {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(174, 185, 204, 0.42);
  border-radius: 50%;
  background: rgba(7, 11, 22, 0.54);
}

.strike-dot.on {
  border-color: var(--red);
  background: var(--red);
  box-shadow: var(--glow-red);
}

.stat {
  min-height: 46px;
  display: grid;
  gap: 2px;
  align-content: center;
  border: 1px solid rgba(174, 185, 204, 0.22);
  border-radius: 8px;
  padding: 6px 10px;
  background: rgba(7, 11, 22, 0.42);
}

.stat-label {
  color: var(--gray);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-value {
  color: var(--white);
  font-weight: 800;
}

.light-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 5px;
  border-radius: 50%;
  vertical-align: -1px;
  box-shadow: 0 0 14px currentColor;
}

.defuser-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(145px, 190px) minmax(320px, 1fr);
  gap: 12px;
}

.side-nav {
  display: grid;
  gap: 8px;
  align-content: start;
}

.side-btn {
  width: 100%;
  min-height: 58px;
  display: grid;
  gap: 2px;
  justify-items: start;
  text-align: left;
}

.side-btn small {
  color: var(--gray);
  font-size: 0.72rem;
}

.cube-panel {
  position: relative;
  min-height: 650px;
  overflow: hidden;
}

.cube-scene {
  width: 100%;
  height: 100%;
  min-height: 650px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 38%, rgba(247, 250, 255, 0.08), transparent 34%),
    linear-gradient(180deg, #172033, #101827);
}

.cube-scene canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}

.wire-tooltip {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 20;
  display: none;
  pointer-events: none;
  padding: 6px 10px;
  border: 1px solid rgba(126, 207, 229, 0.36);
  border-radius: 8px;
  color: var(--white);
  background: rgba(15, 23, 42, 0.9);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1;
  backdrop-filter: blur(8px);
}

.cube-fallback {
  height: 100%;
  min-height: 520px;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
}

.module-panel {
  min-height: 520px;
  overflow: hidden;
}

.module-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.module-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 3vw, 2rem);
}

.module-subtitle {
  margin: 4px 0 0;
  color: var(--gray);
  font-size: 0.92rem;
}

.solved-badge,
.required-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.solved-badge {
  border: 1px solid rgba(61, 255, 138, 0.5);
  color: var(--green);
  background: rgba(61, 255, 138, 0.11);
}

.required-badge {
  border: 1px solid rgba(255, 201, 40, 0.52);
  color: var(--yellow);
  background: rgba(255, 201, 40, 0.11);
}

.module-controls {
  display: grid;
  gap: 14px;
}

.wire-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(34px, 1fr));
  gap: 9px;
  align-items: end;
}

.wire-btn {
  position: relative;
  min-height: 190px;
  border: 1px solid rgba(247, 250, 255, 0.14);
  border-radius: 8px;
  background: rgba(7, 11, 22, 0.46);
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.wire-btn:hover {
  transform: translateY(-2px);
  border-color: var(--yellow);
}

.wire-line {
  position: absolute;
  left: 50%;
  top: 10px;
  bottom: 10px;
  width: 12px;
  border-radius: 999px;
  transform: translateX(-50%);
  box-shadow: inset 0 0 8px rgba(255, 255, 255, 0.38), 0 0 18px currentColor;
}

.wire-index {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  color: var(--white);
  font-weight: 900;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

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

.symbol-btn {
  min-height: 112px;
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 8px;
}

.symbol-glyph {
  font-size: 2.45rem;
  line-height: 1;
}

.symbol-name {
  color: var(--gray);
  font-size: 0.78rem;
  text-align: center;
}

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

.progress-dot {
  width: 28px;
  height: 10px;
  border-radius: 999px;
  background: rgba(174, 185, 204, 0.24);
}

.progress-dot.on {
  background: var(--yellow);
  box-shadow: 0 0 12px rgba(255, 201, 40, 0.42);
}

.switch-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.switch-control {
  min-height: 124px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 8px;
  border: 1px solid rgba(174, 185, 204, 0.24);
  border-radius: 8px;
  background: rgba(7, 11, 22, 0.35);
}

.switch-label {
  color: var(--white);
  font-weight: 900;
}

.switch-track {
  width: 58px;
  height: 90px;
  border-radius: 999px;
  padding: 7px;
  background: #071022;
  border: 1px solid rgba(174, 185, 204, 0.28);
  cursor: pointer;
}

.switch-thumb {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--gray), #62708b);
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.switch-track.up .switch-thumb {
  transform: translateY(32px);
  background: linear-gradient(180deg, var(--green), #10b85d);
  box-shadow: var(--glow-green);
}

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

.letter-wheel {
  display: grid;
  justify-items: center;
  gap: 8px;
  border: 1px solid rgba(174, 185, 204, 0.24);
  border-radius: 8px;
  padding: 10px 8px;
  background: rgba(7, 11, 22, 0.35);
}

.wheel-letter {
  width: 100%;
  min-height: 74px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 201, 40, 0.34);
  border-radius: 8px;
  color: var(--yellow);
  background: rgba(255, 201, 40, 0.1);
  font-family: "Consolas", "Courier New", monospace;
  font-size: 2.3rem;
  font-weight: 900;
}

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

.fuse-btn {
  position: relative;
  min-height: 78px;
  border: 1px solid rgba(247, 250, 255, 0.18);
  border-radius: 8px;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.fuse-btn:hover {
  transform: translateY(-2px);
  border-color: var(--yellow);
}

.fuse-coord {
  position: absolute;
  right: 6px;
  bottom: 5px;
  color: rgba(247, 250, 255, 0.86);
  font-size: 0.72rem;
  font-weight: 900;
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.9);
}

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

.sequence-flash {
  min-height: 82px;
  border: 1px solid rgba(247, 250, 255, 0.18);
  border-radius: 8px;
  animation: seqGlow 1500ms ease-in-out infinite;
  animation-delay: calc(var(--i) * 220ms);
}

@keyframes seqGlow {
  0%,
  55%,
  100% {
    filter: brightness(0.72);
  }
  18% {
    filter: brightness(1.45);
    box-shadow: 0 0 24px currentColor;
  }
}

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

.color-btn {
  min-height: 58px;
  border: 1px solid rgba(247, 250, 255, 0.22);
  border-radius: 8px;
  color: var(--white);
  font-weight: 900;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.72);
  cursor: pointer;
}

.flash-bad {
  animation: badFlash 380ms ease;
}

@keyframes badFlash {
  0%,
  100% {
    filter: none;
  }
  35% {
    filter: saturate(1.6) brightness(1.25);
    box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.3), var(--glow-red);
  }
}

.manual-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(210px, 280px);
  gap: 12px;
}

.manual-notes {
  min-height: 0;
}

.manual-toc {
  display: grid;
  gap: 6px;
  max-height: calc(100vh - 220px);
  overflow: auto;
  padding-right: 4px;
}

.toc-item {
  width: 100%;
  min-height: 36px;
  border: 1px solid rgba(174, 185, 204, 0.18);
  border-radius: 8px;
  padding: 8px 9px;
  background: rgba(7, 11, 22, 0.28);
  color: var(--white);
  text-align: left;
  cursor: pointer;
}

.toc-item.active,
.toc-item:hover {
  border-color: var(--yellow);
  color: var(--yellow);
}

.book-area {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 10px;
}

.manual-toolbar {
  min-width: 0;
}

.book-frame {
  position: relative;
  min-width: 0;
  padding: 0 58px;
}

.book-spread {
  min-height: 570px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  perspective: 1400px;
}

.book-page {
  position: relative;
  min-height: 570px;
  border-radius: 8px;
  padding: 24px;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(90, 64, 28, 0.08), transparent 7%, transparent 93%, rgba(90, 64, 28, 0.08)),
    linear-gradient(180deg, var(--paper-2), var(--paper));
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.32), inset 0 0 0 1px rgba(80, 48, 18, 0.16);
  overflow: auto;
  transform-origin: left center;
}

.book-page,
.book-page *,
.manual-notes,
.manual-notes *,
.manual-toolbar,
.manual-toolbar * {
  font-family: var(--font-manual);
}

.page-turn-forward .book-page {
  animation: pageFlipForward 260ms ease-out;
  transform-origin: left center;
}

.page-turn-backward .book-page {
  animation: pageFlipBackward 260ms ease-out;
  transform-origin: right center;
}

@keyframes pageFlipForward {
  from {
    opacity: 0.48;
    transform: rotateY(-16deg) translateX(16px);
    box-shadow: 0 24px 38px rgba(0, 0, 0, 0.44);
  }
  to {
    opacity: 1;
    transform: rotateY(0) translateX(0);
  }
}

@keyframes pageFlipBackward {
  from {
    opacity: 0.48;
    transform: rotateY(16deg) translateX(-16px);
    box-shadow: 0 24px 38px rgba(0, 0, 0, 0.44);
  }
  to {
    opacity: 1;
    transform: rotateY(0) translateX(0);
  }
}

.book-page h2 {
  margin: 0 0 14px;
  color: #121a33;
  font-size: clamp(1.45rem, 3vw, 2.15rem);
}

.book-page h3 {
  margin: 18px 0 8px;
  color: #1b2747;
}

.book-page p,
.book-page li {
  color: #253252;
  line-height: 1.48;
}

.book-page ul,
.book-page ol {
  padding-left: 20px;
}

.book-page table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  color: #17213f;
  font-size: 0.92rem;
}

.book-page th,
.book-page td {
  border: 1px solid rgba(30, 42, 74, 0.24);
  padding: 7px 8px;
  text-align: left;
  vertical-align: top;
}

.book-page th {
  background: rgba(30, 167, 255, 0.14);
}

.page-number {
  position: sticky;
  bottom: -16px;
  display: block;
  margin-top: 20px;
  color: rgba(16, 23, 45, 0.58);
  text-align: center;
  font-size: 0.82rem;
}

.book-warning {
  border-left: 5px solid var(--orange);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 122, 0, 0.14);
  color: #1b2747;
}

.book-rule {
  border-left: 5px solid var(--blue);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(30, 167, 255, 0.12);
  color: #1b2747;
}

.manual-controls {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.page-arrow {
  position: absolute;
  top: 50%;
  z-index: 5;
  width: 48px;
  height: 92px;
  border: 1px solid rgba(255, 201, 40, 0.45);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(36, 54, 95, 0.94), rgba(7, 11, 22, 0.94));
  color: var(--yellow);
  font-size: 4rem;
  line-height: 1;
  display: grid;
  place-items: center;
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.34);
  cursor: pointer;
  transform: translateY(-50%);
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.page-arrow:hover {
  border-color: var(--yellow);
  box-shadow: 0 18px 32px rgba(0, 0, 0, 0.38), 0 0 20px rgba(255, 201, 40, 0.28);
}

.page-arrow:active {
  transform: translateY(-50%) scale(0.97);
}

.page-arrow:disabled {
  opacity: 0.34;
  cursor: not-allowed;
  box-shadow: none;
}

.page-arrow-left {
  left: 0;
}

.page-arrow-right {
  right: 0;
}

.manual-toc-page {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px;
}

.note-area {
  min-height: 360px;
  resize: vertical;
  padding: 12px;
  line-height: 1.45;
}

.symbol-manual-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

.symbol-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(30, 42, 74, 0.18);
  border-radius: 8px;
  padding: 8px 9px;
  background: rgba(247, 250, 255, 0.62);
}

.symbol-art {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
}

.symbol-art rect {
  fill: #f7faff;
  stroke: #4b3b63;
  stroke-width: 7;
}

.symbol-art g {
  fill: none;
  stroke: #263243;
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.symbol-art g path:first-child,
.symbol-art g circle:first-child {
  fill: #b7a0d9;
}

.symbol-chip span {
  line-height: 1.15;
}

.symbol-chip b {
  min-width: 18px;
  font-size: 1.15rem;
}

.manual-cover {
  min-height: 440px;
  display: grid;
  place-items: center;
  text-align: center;
}

.manual-cover h2 {
  color: var(--red);
  font-size: clamp(2.4rem, 6vw, 4.3rem);
  line-height: 0.98;
  text-shadow: 0 3px 0 rgba(255, 201, 40, 0.45);
}

.end-card {
  text-align: center;
}

.recap-card {
  width: min(1180px, 100%);
}

.end-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 8vw, 5.4rem);
}

.end-title.win {
  color: var(--green);
  text-shadow: var(--glow-green);
}

.end-title.fail {
  color: var(--red);
  text-shadow: var(--glow-red);
}

.recap-rank {
  margin: 6px 0 10px;
  color: var(--yellow);
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, 3rem);
}

.recap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin-top: 18px;
}

.module-result-list {
  display: grid;
  gap: 8px;
  text-align: left;
}

.module-result {
  display: grid;
  grid-template-columns: minmax(140px, 1.2fr) repeat(4, minmax(80px, 1fr));
  gap: 8px;
  align-items: center;
  border: 1px solid rgba(174, 185, 204, 0.2);
  border-radius: 8px;
  padding: 10px;
  background: rgba(7, 11, 22, 0.34);
}

.module-result.solved {
  border-color: rgba(61, 255, 138, 0.32);
}

.module-result.unsolved {
  border-color: rgba(255, 59, 48, 0.32);
}

.callout {
  position: fixed;
  left: 50%;
  top: 22%;
  z-index: 80;
  transform: translateX(-50%);
  border: 2px solid rgba(255, 201, 40, 0.85);
  border-radius: 8px;
  padding: 14px 22px;
  background: rgba(7, 11, 22, 0.9);
  color: var(--yellow);
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 4rem);
  font-weight: 900;
  text-align: center;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.45), 0 0 26px rgba(255, 201, 40, 0.35);
  animation: calloutPop 1500ms ease both;
  pointer-events: none;
}

@keyframes calloutPop {
  0% {
    opacity: 0;
    transform: translateX(-50%) scale(0.82);
  }
  14%,
  72% {
    opacity: 1;
    transform: translateX(-50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) scale(1.08);
  }
}

.confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.confetti span {
  position: absolute;
  left: calc((var(--i) * 37) % 100 * 1%);
  top: -20px;
  width: 10px;
  height: 18px;
  border-radius: 3px;
  background: hsl(calc(var(--i) * 47), 85%, 60%);
  animation: confettiFall calc(2600ms + var(--i) * 36ms) linear infinite;
}

@keyframes confettiFall {
  to {
    transform: translateY(110vh) rotate(540deg);
  }
}

.loss-recap .recap-card {
  animation: lossShake 420ms ease 1;
}

@keyframes lossShake {
  0%,
  100% {
    transform: translateX(0);
  }
  22% {
    transform: translateX(-8px);
  }
  48% {
    transform: translateX(8px);
  }
  72% {
    transform: translateX(-4px);
  }
}

.toast-stack {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 50;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 28px));
}

.toast {
  border: 1px solid rgba(174, 185, 204, 0.26);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(7, 11, 22, 0.92);
  color: var(--white);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.32);
  animation: toastIn 180ms ease-out;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.noscript-card {
  margin: 32px auto;
  width: min(600px, calc(100% - 32px));
  border-radius: 8px;
  padding: 24px;
  background: var(--steel);
  color: var(--white);
}

/* Premium presentation layer */
:root {
  --midnight: #0b1022;
  --steel: #1b2a4c;
  --steel-2: #28406d;
  --blue: #45c8ff;
  --red: #ff6860;
  --orange: #ffae4f;
  --yellow: #ffe071;
  --white: #fbfdff;
  --gray: #c9d5e6;
  --green: #74f2a8;
  --magenta: #dca2ff;
  --black: #050817;
  --ink: #10172d;
  --paper: #f2ead4;
  --paper-2: #fff8e3;
  --shadow: rgba(0, 0, 0, 0.46);
  --panel-border: rgba(255, 255, 255, 0.18);
  --glow-blue: 0 0 26px rgba(69, 200, 255, 0.42);
  --glow-red: 0 0 26px rgba(255, 104, 96, 0.48);
  --glow-green: 0 0 26px rgba(116, 242, 168, 0.4);
  --glass: rgba(11, 16, 34, 0.7);
  --glass-strong: rgba(12, 19, 42, 0.86);
}

body {
  background:
    radial-gradient(circle at 14% 12%, rgba(69, 200, 255, 0.26), transparent 30%),
    radial-gradient(circle at 82% 18%, rgba(220, 162, 255, 0.2), transparent 32%),
    radial-gradient(circle at 46% 96%, rgba(255, 174, 79, 0.14), transparent 38%),
    linear-gradient(135deg, #080d1d 0%, #151f3a 44%, #0e162c 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.12) 0 1px, transparent 1.5px),
    linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.035), transparent);
  background-size: 46px 46px, 100% 100%;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.42), transparent 76%);
}

.screen {
  position: relative;
  isolation: isolate;
  animation: screenIn 320ms cubic-bezier(0.2, 0.85, 0.25, 1);
}

.screen::after {
  content: "";
  position: fixed;
  inset: auto 5vw 0;
  z-index: -1;
  height: 34vh;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(69, 200, 255, 0.12), transparent 68%);
  filter: blur(28px);
}

.screen.menu-screen {
  padding: clamp(20px, 3vw, 42px);
  justify-content: center;
  gap: clamp(16px, 3vh, 28px);
}

.screen.menu-screen::before {
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 224, 113, 0.14), transparent 26%),
    linear-gradient(180deg, rgba(5, 8, 23, 0.16), rgba(5, 8, 23, 0.82));
}

.menu-scene {
  filter: saturate(1.18) contrast(1.04);
}

.menu-scene::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(5, 8, 23, 0.72), rgba(5, 8, 23, 0.18) 50%, rgba(5, 8, 23, 0.62)),
    radial-gradient(circle at 50% 18%, transparent 0 28%, rgba(5, 8, 23, 0.48) 70%);
}

.menu-main {
  width: min(620px, 100%);
  gap: clamp(16px, 2.3vh, 26px);
  padding-top: 0;
  animation: menuFloat 5.6s ease-in-out infinite;
}

@keyframes menuFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

.logo-wrap {
  min-height: clamp(140px, 20vh, 220px);
}

.game-logo {
  width: min(620px, 84vw);
  max-height: 230px;
  filter:
    drop-shadow(0 20px 38px rgba(0, 0, 0, 0.58))
    drop-shadow(0 0 28px rgba(69, 200, 255, 0.28));
}

.fallback-title {
  letter-spacing: 0.01em;
  text-shadow:
    0 7px 0 rgba(0, 0, 0, 0.38),
    0 0 36px rgba(69, 200, 255, 0.52),
    0 0 54px rgba(255, 224, 113, 0.24);
}

.tagline {
  max-width: 540px;
  color: rgba(251, 253, 255, 0.86);
  font-size: clamp(1.06rem, 1.65vw, 1.28rem);
  font-weight: 600;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.42);
}

.screen.menu-screen .menu-actions {
  width: min(440px, calc(100vw - 40px));
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.screen.menu-screen .menu-actions .btn {
  width: 100%;
  min-height: 64px;
  justify-content: center;
  padding: 15px 26px;
  font-size: 1.14rem;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.3);
}

.credit {
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(5, 8, 23, 0.38);
  color: rgba(251, 253, 255, 0.8);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(14px);
}

.top-actions,
.music-control {
  border-radius: 999px;
}

.music-control {
  padding: 7px 9px;
  background: rgba(8, 13, 29, 0.66);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(18px);
}

.volume-slider {
  accent-color: var(--blue);
  filter: drop-shadow(0 0 8px rgba(69, 200, 255, 0.22));
}

.btn {
  position: relative;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  overflow: hidden;
  border-color: rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 12px 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent 42%),
    linear-gradient(180deg, rgba(48, 71, 120, 0.98), rgba(18, 29, 60, 0.98));
  font-weight: 800;
  box-shadow:
    0 16px 34px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 -14px 26px rgba(0, 0, 0, 0.12);
  transition:
    transform 180ms cubic-bezier(0.2, 0.85, 0.25, 1),
    border-color 180ms ease,
    box-shadow 180ms ease,
    filter 180ms ease,
    background 180ms ease;
}

.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 0 32%, rgba(255, 255, 255, 0.18) 45%, transparent 58% 100%);
  transform: translateX(-115%);
  transition: transform 420ms ease;
}

.btn:hover {
  transform: translateY(-3px);
  border-color: rgba(69, 200, 255, 0.72);
  filter: saturate(1.08) brightness(1.04);
  box-shadow:
    0 22px 42px rgba(0, 0, 0, 0.36),
    0 0 28px rgba(69, 200, 255, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.btn:hover::before {
  transform: translateX(115%);
}

.btn:active {
  transform: translateY(0) scale(0.985);
}

.btn.primary {
  color: #04101d;
  border-color: rgba(139, 226, 255, 0.86);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.34), transparent 42%),
    linear-gradient(180deg, #79dcff, #29a7ee 54%, #0872c4);
  box-shadow:
    0 18px 38px rgba(69, 200, 255, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -16px 26px rgba(4, 16, 29, 0.16);
}

.btn.orange {
  color: #201003;
  border-color: rgba(255, 224, 113, 0.8);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent 42%),
    linear-gradient(180deg, #ffe071, #ffae4f 52%, #e66c2d);
  box-shadow: 0 18px 36px rgba(255, 174, 79, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.btn.danger {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.2), transparent 42%),
    linear-gradient(180deg, #ff8f89, #ff6860 54%, #bf2923);
}

.btn.ghost {
  color: rgba(251, 253, 255, 0.9);
  background: rgba(12, 19, 42, 0.66);
  backdrop-filter: blur(14px);
}

.btn.small {
  min-height: 38px;
  padding: 8px 12px;
  font-size: 0.9rem;
}

.btn.active,
.btn.selected {
  border-color: var(--yellow);
  box-shadow:
    0 0 0 2px rgba(255, 224, 113, 0.18),
    0 18px 36px rgba(255, 174, 79, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.panel {
  border-color: rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 28%),
    radial-gradient(circle at 12% 0%, rgba(69, 200, 255, 0.16), transparent 42%),
    linear-gradient(180deg, rgba(27, 42, 76, 0.88), rgba(8, 13, 29, 0.88));
  box-shadow:
    0 24px 58px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -1px 0 rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(18px) saturate(1.14);
}

.panel-inner {
  padding: clamp(18px, 2.1vw, 28px);
}

.connect-screen,
.lobby-screen,
.end-screen {
  padding: clamp(18px, 3vw, 38px);
  background:
    radial-gradient(circle at 22% 18%, rgba(116, 242, 168, 0.11), transparent 30%),
    radial-gradient(circle at 82% 12%, rgba(220, 162, 255, 0.12), transparent 32%);
}

.connect-card,
.lobby-card,
.end-card {
  animation: cardRise 360ms cubic-bezier(0.2, 0.85, 0.25, 1);
}

@keyframes cardRise {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.section-title {
  margin-bottom: 16px;
  font-size: clamp(1.55rem, 2.2vw, 2.2rem);
  font-weight: 900;
  text-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

.muted {
  color: rgba(201, 213, 230, 0.82);
}

.code-box {
  min-width: 180px;
  min-height: 66px;
  border-color: rgba(255, 224, 113, 0.72);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 224, 113, 0.16), rgba(255, 174, 79, 0.08)),
    rgba(5, 8, 23, 0.62);
  font-size: 2rem;
  box-shadow: 0 0 28px rgba(255, 224, 113, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.text-input,
.search-input,
.note-area {
  border-color: rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 48%),
    rgba(5, 8, 23, 0.62);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 10px 24px rgba(0, 0, 0, 0.14);
}

.text-input,
.search-input {
  min-height: 50px;
  padding: 12px 14px;
  font-weight: 700;
}

.role-pill,
.status-pill {
  min-height: 34px;
  border-color: rgba(255, 255, 255, 0.16);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), transparent 56%),
    rgba(5, 8, 23, 0.44);
  color: rgba(251, 253, 255, 0.82);
  font-weight: 800;
}

.buddy-card,
.role-choice-card,
.mission-card,
.check-card,
.custom-field {
  border-color: rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), transparent 34%),
    rgba(5, 8, 23, 0.38);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.buddy-card:hover,
.role-choice-card:hover,
.mission-card:hover,
.check-card:hover,
.custom-field:hover {
  transform: translateY(-3px);
  border-color: rgba(69, 200, 255, 0.42);
  box-shadow:
    0 18px 34px rgba(0, 0, 0, 0.22),
    0 0 24px rgba(69, 200, 255, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.mission-card {
  position: relative;
  overflow: hidden;
  padding: 18px;
}

.mission-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--blue), var(--yellow), var(--magenta));
  opacity: 0.65;
}

.mission-card h2 {
  font-size: 1.35rem;
  color: var(--white);
}

.mission-card.completed {
  background:
    radial-gradient(circle at 86% 8%, rgba(116, 242, 168, 0.18), transparent 32%),
    rgba(5, 8, 23, 0.38);
}

.mission-meta {
  gap: 8px;
}

.custom-grid {
  gap: 14px;
}

.custom-field {
  padding: 14px;
}

.custom-field > span {
  color: rgba(201, 213, 230, 0.86);
  font-weight: 900;
}

.check-field {
  border-radius: 8px;
}

.game-screen {
  padding: 16px;
  background:
    radial-gradient(circle at 20% 12%, rgba(69, 200, 255, 0.12), transparent 28%),
    radial-gradient(circle at 82% 18%, rgba(255, 224, 113, 0.1), transparent 30%),
    linear-gradient(180deg, rgba(5, 8, 23, 0.1), rgba(5, 8, 23, 0.44));
}

.game-shell {
  gap: 14px;
}

.hud {
  grid-template-columns: minmax(172px, auto) 1fr auto;
  gap: 14px;
  align-items: stretch;
}

.timer {
  min-width: 172px;
  min-height: 70px;
  border-color: rgba(255, 224, 113, 0.88);
  border-radius: 8px;
  color: #ffe88a;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 224, 113, 0.2), transparent 55%),
    rgba(5, 8, 23, 0.78);
  font-size: clamp(1.75rem, 4vw, 2.8rem);
  letter-spacing: 0.02em;
  box-shadow:
    0 0 0 1px rgba(255, 224, 113, 0.08),
    0 0 34px rgba(255, 224, 113, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.hud-main {
  align-items: stretch;
  gap: 10px;
}

.stat {
  min-height: 58px;
  min-width: 124px;
  border-color: rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  padding: 8px 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 42%),
    rgba(5, 8, 23, 0.44);
}

.stat-label {
  color: rgba(201, 213, 230, 0.78);
  font-size: 0.7rem;
  font-weight: 900;
}

.stat-value {
  font-size: 1.04rem;
  line-height: 1.05;
}

.strike-dot {
  width: 24px;
  height: 24px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.defuser-layout {
  grid-template-columns: minmax(160px, 210px) minmax(360px, 1fr);
  gap: 14px;
}

.side-nav {
  gap: 10px;
}

.side-btn {
  min-height: 68px;
  padding: 12px 14px;
  justify-items: start;
  align-content: center;
}

.side-btn small {
  color: rgba(201, 213, 230, 0.78);
  font-weight: 700;
}

.cube-panel {
  min-height: 690px;
  border-color: rgba(69, 200, 255, 0.2);
  background:
    radial-gradient(circle at 50% 38%, rgba(69, 200, 255, 0.12), transparent 42%),
    linear-gradient(180deg, rgba(14, 24, 48, 0.88), rgba(5, 8, 23, 0.9));
}

.cube-panel::before {
  content: "";
  position: absolute;
  inset: 10px;
  z-index: 1;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  box-shadow: inset 0 0 80px rgba(69, 200, 255, 0.08);
}

.cube-scene {
  min-height: 690px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 42%, rgba(251, 253, 255, 0.12), transparent 28%),
    radial-gradient(circle at 50% 80%, rgba(69, 200, 255, 0.12), transparent 42%),
    linear-gradient(180deg, #111b32, #070b16);
}

.wire-tooltip {
  position: absolute;
  padding: 8px 12px;
  border-color: rgba(139, 226, 255, 0.5);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 44%),
    rgba(5, 8, 23, 0.9);
  font-size: 0.92rem;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.34), 0 0 18px rgba(69, 200, 255, 0.16);
}

.manual-layout {
  gap: 16px;
}

.manual-toolbar,
.manual-notes {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), transparent 38%),
    rgba(8, 13, 29, 0.76);
}

.book-frame {
  padding: 0 68px;
}

.book-spread {
  min-height: 620px;
  gap: 16px;
  filter: drop-shadow(0 28px 42px rgba(0, 0, 0, 0.42));
}

.book-page {
  min-height: 620px;
  border: 1px solid rgba(94, 62, 30, 0.18);
  border-radius: 8px;
  padding: clamp(24px, 2.2vw, 34px);
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.72), transparent 22%),
    linear-gradient(90deg, rgba(91, 59, 24, 0.1), transparent 8%, transparent 92%, rgba(91, 59, 24, 0.1)),
    repeating-linear-gradient(0deg, rgba(72, 49, 20, 0.025) 0 1px, transparent 1px 26px),
    linear-gradient(180deg, #fff7df, #efe5c9);
  box-shadow:
    0 24px 48px rgba(0, 0, 0, 0.34),
    inset 0 0 0 1px rgba(255, 255, 255, 0.38),
    inset 0 -20px 50px rgba(91, 59, 24, 0.08);
}

.book-page h2 {
  font-size: clamp(1.65rem, 3vw, 2.45rem);
  line-height: 1.05;
}

.book-page h3 {
  font-size: 1.2rem;
}

.book-page p,
.book-page li {
  font-size: 0.98rem;
  line-height: 1.58;
}

.book-page th,
.book-page td {
  padding: 9px 10px;
}

.book-warning,
.book-rule {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

.page-arrow {
  width: 56px;
  height: 104px;
  border-color: rgba(255, 224, 113, 0.58);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.13), transparent 40%),
    linear-gradient(180deg, rgba(38, 58, 103, 0.96), rgba(5, 8, 23, 0.96));
  color: #ffe88a;
}

.note-area {
  min-height: 420px;
  padding: 16px;
}

.toc-item {
  min-height: 42px;
  border-color: rgba(30, 42, 74, 0.18);
  background: rgba(255, 255, 255, 0.54);
  color: #18223e;
  font-weight: 800;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.toc-item:hover {
  transform: translateY(-1px);
  background: rgba(255, 224, 113, 0.22);
}

.symbol-chip {
  min-height: 58px;
  border-color: rgba(30, 42, 74, 0.16);
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 8px 16px rgba(91, 59, 24, 0.08);
}

.end-screen {
  overflow: hidden;
}

.win-recap {
  background:
    radial-gradient(circle at 50% 18%, rgba(116, 242, 168, 0.22), transparent 35%),
    radial-gradient(circle at 14% 78%, rgba(69, 200, 255, 0.14), transparent 32%);
}

.loss-recap {
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 104, 96, 0.2), transparent 35%),
    radial-gradient(circle at 84% 76%, rgba(255, 174, 79, 0.12), transparent 32%);
}

.recap-card {
  position: relative;
  overflow: hidden;
}

.recap-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 6px;
  background: linear-gradient(90deg, var(--blue), var(--green), var(--yellow), var(--magenta));
  opacity: 0.85;
}

.end-title {
  letter-spacing: 0.01em;
}

.recap-rank {
  text-shadow: 0 0 26px rgba(255, 224, 113, 0.28);
}

.recap-grid {
  gap: 10px;
}

.module-result {
  border-color: rgba(255, 255, 255, 0.14);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 40%),
    rgba(5, 8, 23, 0.42);
}

.callout {
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent 44%),
    rgba(5, 8, 23, 0.92);
}

.toast {
  border-color: rgba(255, 255, 255, 0.16);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 44%),
    rgba(5, 8, 23, 0.9);
  backdrop-filter: blur(14px);
}

@media (max-width: 1100px) {
  .defuser-layout,
  .manual-layout {
    grid-template-columns: 1fr;
  }

  .cube-panel,
  .cube-scene {
    min-height: 560px;
  }

  .book-frame {
    padding: 0 54px;
  }
}

@media (max-width: 760px) {
  .screen.menu-screen .menu-actions {
    width: min(420px, 100%);
  }

  .screen.menu-screen .menu-actions .btn {
    min-height: 58px;
    font-size: 1.04rem;
  }

  .top-actions {
    position: static;
    justify-content: center;
    padding-top: 10px;
    flex-wrap: wrap;
  }

  .hud {
    grid-template-columns: 1fr;
  }

  .hud-main {
    justify-content: stretch;
  }

  .stat {
    flex: 1 1 140px;
  }

  .defuser-layout,
  .connect-grid,
  .lobby-grid,
  .book-spread {
    grid-template-columns: 1fr;
  }

  .book-page.right-page {
    display: none;
  }

  .book-spread,
  .book-page {
    min-height: 540px;
  }

  .book-frame {
    padding: 0 42px;
  }

  .page-arrow {
    width: 38px;
    height: 78px;
    font-size: 3.1rem;
  }

  .module-result {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .menu-main {
    gap: 14px;
  }

  .logo-wrap {
    min-height: 120px;
  }

  .game-logo {
    width: min(94vw, 420px);
  }

  .screen.menu-screen .menu-actions .btn {
    min-height: 54px;
  }

  .music-control {
    width: 100%;
    justify-content: center;
  }

  .cube-panel,
  .cube-scene {
    min-height: 500px;
  }

  .side-nav {
    grid-template-columns: 1fr;
  }

  .book-frame {
    padding: 0 34px;
  }
}

@media (max-width: 1100px) {
  .defuser-layout,
  .manual-layout {
    grid-template-columns: 1fr;
  }

  .side-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .cube-panel,
  .cube-scene {
    min-height: 540px;
  }

  .manual-toc {
    max-height: none;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }
}

@media (max-width: 760px) {
  .screen,
  .game-screen {
    padding: 10px;
  }

  .top-actions {
    position: static;
    justify-content: center;
    padding: 10px 10px 0;
    flex-wrap: wrap;
  }

  .hud {
    grid-template-columns: 1fr;
  }

  .hud-main {
    justify-content: stretch;
  }

  .stat {
    flex: 1 1 120px;
  }

  .connect-grid,
  .lobby-grid,
  .book-spread {
    grid-template-columns: 1fr;
  }

  .book-page.right-page {
    display: none;
  }

  .book-spread,
  .book-page {
    min-height: 520px;
  }

  .book-frame {
    padding: 0 46px;
  }

  .page-arrow {
    width: 40px;
    height: 74px;
    font-size: 3.1rem;
  }

  .side-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .symbol-grid,
  .switch-grid,
  .wheel-row,
  .response-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sequence-strip,
  .fuse-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .input-row {
    flex-direction: column;
  }

  .module-result {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .music-control {
    width: 100%;
    justify-content: center;
  }

  .volume-slider {
    width: 96px;
  }

  .side-nav {
    grid-template-columns: 1fr;
  }

  .wire-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .wire-btn {
    min-height: 132px;
  }

  .symbol-grid,
  .switch-grid,
  .wheel-row,
  .response-row,
  .sequence-strip {
    grid-template-columns: 1fr;
  }

  .book-frame {
    padding: 0 36px;
  }

  .page-arrow {
    width: 32px;
    height: 64px;
    font-size: 2.6rem;
  }
}

/* Final presentation guards after legacy responsive rules */
input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--blue);
  filter: drop-shadow(0 0 8px rgba(69, 200, 255, 0.18));
}

select.text-input {
  cursor: pointer;
}

.screen.menu-screen .menu-actions {
  display: grid;
  grid-template-columns: 1fr;
  width: min(440px, calc(100vw - 40px));
  gap: 14px;
}

.screen.menu-screen .menu-actions .btn {
  width: 100%;
  min-height: 64px;
  font-size: 1.14rem;
}

@media (max-width: 1100px) {
  .cube-panel,
  .cube-scene {
    min-height: 560px;
  }
}

@media (max-width: 760px) {
  .screen.menu-screen .menu-actions .btn {
    min-height: 58px;
    font-size: 1.04rem;
  }

  .book-spread,
  .book-page {
    min-height: 540px;
  }

  .book-frame {
    padding: 0 42px;
  }

  .page-arrow {
    width: 38px;
    height: 78px;
    font-size: 3.1rem;
  }
}

@media (max-width: 480px) {
  .screen.menu-screen .menu-actions {
    gap: 11px;
  }

  .screen.menu-screen .menu-actions .btn {
    min-height: 54px;
  }

  .cube-panel,
  .cube-scene {
    min-height: 500px;
  }

  .book-frame {
    padding: 0 34px;
  }
}

/* AAA manual book presentation */
.book-frame {
  perspective: 1900px;
  transform-style: preserve-3d;
  filter: drop-shadow(0 34px 54px rgba(0, 0, 0, 0.46));
}

.book-shell {
  position: relative;
  min-height: 650px;
  padding: 22px 26px 28px;
  border-radius: 8px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 224, 113, 0.12), transparent 42%),
    linear-gradient(90deg, #4b2c2f, #7a4a38 9%, #3d2630 50%, #7a4a38 91%, #4b2c2f);
  box-shadow:
    0 32px 70px rgba(0, 0, 0, 0.48),
    inset 0 2px 0 rgba(255, 255, 255, 0.18),
    inset 0 -10px 28px rgba(0, 0, 0, 0.28);
  transform-style: preserve-3d;
  transition: transform 560ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 560ms ease;
  will-change: transform;
}

.book-shell.is-flipping {
  transform: translateY(-4px) rotateX(1.2deg) scale(1.006);
  box-shadow:
    0 42px 86px rgba(0, 0, 0, 0.56),
    inset 0 2px 0 rgba(255, 255, 255, 0.2),
    inset 0 -12px 30px rgba(0, 0, 0, 0.34);
}

.book-cover-layer {
  position: absolute;
  inset: 8px;
  border-radius: 8px;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.06), transparent 12%, rgba(0, 0, 0, 0.22) 50%, transparent 88%, rgba(255, 255, 255, 0.06)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 14px);
  box-shadow: inset 0 0 0 2px rgba(255, 224, 113, 0.1);
}

.page-stack {
  position: absolute;
  top: 34px;
  bottom: 32px;
  width: 28px;
  pointer-events: none;
  z-index: 1;
  background:
    repeating-linear-gradient(180deg, rgba(255, 248, 227, 0.9) 0 3px, rgba(198, 174, 132, 0.88) 3px 4px);
  opacity: 0.78;
  box-shadow: inset 0 0 18px rgba(91, 59, 24, 0.2);
}

.page-stack-left {
  left: 18px;
  border-radius: 8px 0 0 8px;
  transform: skewY(-1deg);
}

.page-stack-right {
  right: 18px;
  border-radius: 0 8px 8px 0;
  transform: skewY(1deg);
}

.book-gutter {
  position: absolute;
  top: 22px;
  bottom: 28px;
  left: 50%;
  z-index: 8;
  width: 46px;
  transform: translateX(-50%);
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, rgba(0, 0, 0, 0.44), transparent 64%),
    linear-gradient(90deg, transparent, rgba(72, 49, 20, 0.24), rgba(0, 0, 0, 0.32), rgba(72, 49, 20, 0.24), transparent);
  mix-blend-mode: multiply;
}

.book-shell .book-spread {
  position: relative;
  z-index: 3;
  min-height: 606px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  perspective: none;
  filter: none;
  transform-style: preserve-3d;
}

.book-shell .page-turn-forward .book-page,
.book-shell .page-turn-backward .book-page {
  animation: none;
}

.book-shell .book-page {
  min-height: 606px;
  max-height: min(70vh, 760px);
  overflow: auto;
  border-radius: 8px 4px 4px 8px;
  background:
    radial-gradient(circle at 12% 10%, rgba(255, 255, 255, 0.62), transparent 24%),
    radial-gradient(circle at 78% 84%, rgba(126, 87, 41, 0.06), transparent 32%),
    linear-gradient(90deg, rgba(100, 72, 34, 0.12), transparent 8%, transparent 92%, rgba(100, 72, 34, 0.09)),
    repeating-linear-gradient(0deg, rgba(93, 66, 32, 0.022) 0 1px, transparent 1px 24px),
    linear-gradient(180deg, #fff8e6, #eee2c5);
  box-shadow:
    0 22px 40px rgba(0, 0, 0, 0.24),
    inset 0 0 0 1px rgba(84, 52, 21, 0.16),
    inset 0 -20px 46px rgba(84, 52, 21, 0.08);
  transform: translateZ(4px);
  transform-origin: center center;
}

.book-shell .book-page:not(.right-page) {
  border-radius: 8px 3px 3px 8px;
  box-shadow:
    12px 20px 42px rgba(0, 0, 0, 0.2),
    inset -18px 0 28px rgba(75, 45, 21, 0.1),
    inset 0 0 0 1px rgba(84, 52, 21, 0.16);
}

.book-shell .book-page.right-page {
  border-radius: 3px 8px 8px 3px;
  box-shadow:
    -12px 20px 42px rgba(0, 0, 0, 0.2),
    inset 18px 0 28px rgba(75, 45, 21, 0.1),
    inset 0 0 0 1px rgba(84, 52, 21, 0.16);
}

.book-shell .book-page::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.38), transparent 18%),
    radial-gradient(circle at 78% 16%, rgba(110, 78, 40, 0.06), transparent 9%),
    radial-gradient(circle at 20% 72%, rgba(110, 78, 40, 0.045), transparent 12%);
  mix-blend-mode: multiply;
}

.book-page-content {
  position: relative;
  z-index: 1;
}

.turning-page {
  position: absolute;
  top: 22px;
  bottom: 28px;
  z-index: 12;
  width: calc(50% - 26px);
  transform-style: preserve-3d;
  pointer-events: none;
  will-change: transform;
}

.turning-page::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.24), transparent 36%, rgba(255, 255, 255, 0.22) 72%, transparent);
  opacity: 0;
  animation: pageCurlLight 560ms cubic-bezier(0.22, 1, 0.36, 1) both;
  will-change: opacity;
}

.turning-forward {
  left: 50%;
  transform-origin: left center;
  animation: turnPageForward 560ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.turning-backward {
  right: 50%;
  transform-origin: right center;
  animation: turnPageBackward 560ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.flip-jump .turning-forward,
.flip-jump .turning-backward,
.flip-jump .turning-page::after {
  animation-duration: 430ms;
}

.turning-face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  padding: clamp(24px, 2.2vw, 34px);
  color: var(--ink);
  border: 1px solid rgba(84, 52, 21, 0.18);
  background:
    radial-gradient(circle at 16% 10%, rgba(255, 255, 255, 0.68), transparent 24%),
    repeating-linear-gradient(0deg, rgba(93, 66, 32, 0.024) 0 1px, transparent 1px 24px),
    linear-gradient(180deg, #fff8e6, #eee2c5);
  box-shadow:
    0 28px 50px rgba(0, 0, 0, 0.34),
    inset 0 0 0 1px rgba(255, 255, 255, 0.36);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: translateZ(0);
  will-change: transform;
}

.turning-front {
  border-radius: 3px 8px 8px 3px;
}

.turning-back {
  border-radius: 8px 3px 3px 8px;
  transform: rotateY(180deg);
  filter: brightness(0.92) saturate(0.96);
}

.turning-backward .turning-front {
  border-radius: 8px 3px 3px 8px;
}

.turning-backward .turning-back {
  border-radius: 3px 8px 8px 3px;
}

@keyframes turnPageForward {
  0% {
    transform: translate3d(0, 0, 18px) rotateY(0deg);
  }
  45% {
    transform: translate3d(-2px, -1px, 36px) rotateY(-92deg) skewY(-0.8deg);
  }
  78% {
    transform: translate3d(-1px, 0, 24px) rotateY(-160deg) skewY(0.35deg);
  }
  100% {
    transform: translate3d(0, 0, 4px) rotateY(-180deg);
  }
}

@keyframes turnPageBackward {
  0% {
    transform: translate3d(0, 0, 18px) rotateY(0deg);
  }
  45% {
    transform: translate3d(2px, -1px, 36px) rotateY(92deg) skewY(0.8deg);
  }
  78% {
    transform: translate3d(1px, 0, 24px) rotateY(160deg) skewY(-0.35deg);
  }
  100% {
    transform: translate3d(0, 0, 4px) rotateY(180deg);
  }
}

@keyframes pageCurlLight {
  0%,
  100% {
    opacity: 0.12;
  }
  44% {
    opacity: 0.54;
  }
}

.page-arrow {
  border-radius: 999px;
  width: 58px;
  height: 58px;
  border-color: rgba(255, 224, 113, 0.5);
  background:
    radial-gradient(circle at 35% 22%, rgba(255, 255, 255, 0.32), transparent 24%),
    linear-gradient(180deg, #8e693f, #4f3326);
  color: #ffe88a;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  box-shadow:
    0 18px 32px rgba(0, 0, 0, 0.34),
    inset 0 2px 0 rgba(255, 255, 255, 0.22),
    inset 0 -8px 18px rgba(0, 0, 0, 0.24);
}

.page-arrow:hover:not(:disabled) {
  transform: translateY(-50%) scale(1.08);
  border-color: #ffe88a;
  box-shadow:
    0 22px 38px rgba(0, 0, 0, 0.38),
    0 0 28px rgba(255, 224, 113, 0.28),
    inset 0 2px 0 rgba(255, 255, 255, 0.28);
}

.page-arrow:active:not(:disabled) {
  transform: translateY(-50%) scale(0.96);
}

.page-arrow:disabled {
  opacity: 0.25;
  filter: grayscale(0.7);
}

.manual-notes {
  align-self: start;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 36%),
    linear-gradient(180deg, rgba(63, 45, 34, 0.92), rgba(25, 20, 28, 0.92));
}

.manual-notes .panel-inner {
  position: relative;
}

.manual-notes .panel-inner::before {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  top: 58px;
  height: 16px;
  border-radius: 999px;
  background: linear-gradient(90deg, #d3a762, #f1d68a, #d3a762);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
}

.note-area {
  margin-top: 12px;
  color: #1c2845;
  background:
    repeating-linear-gradient(0deg, transparent 0 27px, rgba(30, 42, 74, 0.12) 27px 28px),
    linear-gradient(180deg, #fff7bd, #f4e897);
  border-color: rgba(94, 62, 30, 0.22);
  box-shadow:
    0 18px 32px rgba(0, 0, 0, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

@media (max-width: 760px) {
  .book-shell {
    min-height: 560px;
    padding: 18px 18px 24px;
  }

  .book-shell .book-spread {
    min-height: 536px;
    grid-template-columns: 1fr;
  }

  .book-gutter,
  .page-stack-left {
    display: none;
  }

  .page-stack-right {
    right: 10px;
  }

  .book-shell .book-page,
  .book-shell .book-page.right-page {
    min-height: 536px;
    max-height: 68vh;
    border-radius: 8px;
  }

  .book-shell .book-page.right-page {
    display: none;
  }

  .turning-page {
    left: 18px;
    right: 18px;
    width: auto;
  }

  .turning-forward,
  .turning-backward {
    left: 18px;
    right: 18px;
    transform-origin: right center;
  }

  .turning-backward {
    transform-origin: left center;
  }
}
