:root {
  --ink: #1a2332;
  --ink-soft: rgba(26, 35, 50, 0.55);
  --accent: #ff6b4a;
  --accent-deep: #e84f2c;
  --glass: rgba(255, 255, 255, 0.42);
  --glass-border: rgba(255, 255, 255, 0.55);
  --panel: rgba(255, 255, 255, 0.9);
  --shadow: 0 18px 48px rgba(26, 35, 50, 0.18);
  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: "Manrope", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: var(--app-height, 100dvh);
  max-height: var(--app-height, 100dvh);
  overflow: hidden;
  overscroll-behavior: none;
  position: fixed;
  inset: 0;
  background: #7ec8e3;
  font-family: var(--font-body);
  color: var(--ink);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) 16px 0;
  pointer-events: none;
}

.hud > * {
  pointer-events: auto;
}

.brand-hud {
  pointer-events: none;
  flex: 1;
  justify-content: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(145deg, #ff8a6b, var(--accent-deep));
  box-shadow: 0 6px 16px rgba(255, 107, 74, 0.45);
}

.brand-mark-lg {
  width: 22px;
  height: 22px;
  border-radius: 6px;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.35rem, 4.5vw, 1.75rem);
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.score-wrap {
  text-align: right;
  line-height: 1.05;
  min-width: 52px;
  pointer-events: none;
}

.score-label {
  display: block;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 2px;
}

.score {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.5rem, 5vw, 2rem);
  letter-spacing: -0.05em;
  color: var(--ink);
}

.icon-btn {
  appearance: none;
  border: 1px solid var(--glass-border);
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--ink);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(26, 35, 50, 0.1);
}

.hint {
  position: absolute;
  left: 50%;
  bottom: max(36px, calc(env(safe-area-inset-bottom) + 28px));
  transform: translateX(-50%);
  z-index: 2;
  pointer-events: none;
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.hint p {
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

.hint.fade {
  opacity: 0;
  transform: translateX(-50%) translateY(10px);
}

/* Screens / sheets */
.screen,
.sheet,
.overlay {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background: linear-gradient(
    180deg,
    rgba(126, 200, 227, 0.35),
    rgba(26, 35, 50, 0.38)
  );
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.sheet {
  z-index: 8;
  align-items: center;
}

.overlay {
  z-index: 7;
  align-items: center;
  touch-action: none;
}

.menu-card,
.sheet-card,
.panel {
  width: min(100%, 400px);
  margin: auto;
  padding: 28px 22px 22px;
  border-radius: 28px;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow);
  animation: panel-in 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.menu-hero {
  text-align: center;
  margin-bottom: 22px;
}

.menu-title {
  margin-top: 10px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.4rem, 10vw, 3.2rem);
  letter-spacing: -0.06em;
  line-height: 0.95;
}

.menu-tagline {
  margin-top: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink-soft);
}

.best-line {
  margin-top: 12px;
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(26, 35, 50, 0.06);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.menu-actions {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.menu-block {
  margin-top: 14px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(126, 200, 227, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.45);
}

.menu-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.menu-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.volume-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.volume-icon,
.volume-val {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink-soft);
  min-width: 2.4em;
}

.slider {
  flex: 1;
  appearance: none;
  height: 6px;
  border-radius: 999px;
  background: rgba(26, 35, 50, 0.12);
  outline: none;
}

.slider::-webkit-slider-thumb {
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(145deg, #ff8a6b, var(--accent-deep));
  box-shadow: 0 4px 12px rgba(232, 79, 44, 0.35);
  cursor: pointer;
}

.slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(145deg, #ff8a6b, var(--accent-deep));
  cursor: pointer;
}

.diff-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.diff-btn {
  appearance: none;
  border: 1px solid rgba(26, 35, 50, 0.1);
  border-radius: 14px;
  padding: 12px 8px;
  background: rgba(255, 255, 255, 0.7);
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
}

.diff-btn.active {
  background: linear-gradient(145deg, #ff8a6b, var(--accent-deep));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 8px 18px rgba(232, 79, 44, 0.28);
}

.diff-desc {
  margin-top: 10px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink-soft);
  line-height: 1.35;
}

.toggle {
  appearance: none;
  border: none;
  min-width: 64px;
  padding: 8px 14px;
  border-radius: 999px;
  background: linear-gradient(145deg, #ff8a6b, var(--accent-deep));
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(232, 79, 44, 0.28);
}

.toggle.off {
  background: rgba(26, 35, 50, 0.12);
  color: var(--ink-soft);
  box-shadow: none;
}

.btn {
  appearance: none;
  border: none;
  width: 100%;
  padding: 15px 20px;
  border-radius: 16px;
  background: linear-gradient(145deg, #ff8a6b, var(--accent-deep));
  color: #fff;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(232, 79, 44, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  box-shadow: none;
  border: 1px solid rgba(26, 35, 50, 0.08);
}

.btn-gap {
  margin-top: 10px;
}

.sheet-card {
  position: relative;
  text-align: left;
}

.sheet-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 12px;
  background: rgba(26, 35, 50, 0.08);
  font-size: 1.4rem;
  line-height: 1;
  color: var(--ink);
  cursor: pointer;
}

.sheet-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.7rem;
  letter-spacing: -0.04em;
  margin-bottom: 16px;
}

.sheet-list {
  list-style: none;
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.sheet-list li {
  position: relative;
  padding-left: 16px;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.45;
  color: var(--ink);
}

.sheet-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--accent);
}

.sheet-note {
  margin-bottom: 18px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink-soft);
}

.panel {
  text-align: center;
}

.panel-kicker {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 10px;
}

.panel-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(3.2rem, 14vw, 4.2rem);
  letter-spacing: -0.06em;
  line-height: 0.9;
  color: var(--ink);
}

.panel-sub {
  margin-top: 8px;
  margin-bottom: 26px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink-soft);
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
