/* ════════════════════════════════════════
   GAME LAYOUT — portrait-first column
   60% game  |  20% info  |  20% buttons
   ════════════════════════════════════════ */

html, body {
  height: 100%;
  overflow: hidden;
  background: #0a0906;
}

#game-container {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100dvh;   /* dvh: accounts for mobile browser chrome */
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

/* ── Entrance animation ── */
@keyframes panel-rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0);   }
}

#info-panel  { animation: panel-rise 0.5s 0.1s cubic-bezier(0.22,1,0.36,1) both; }
#button-bar  { animation: panel-rise 0.5s 0.2s cubic-bezier(0.22,1,0.36,1) both; }

/* ── TOP: game view (57.5%) ── */
#game-view {
  position: relative;
  flex: 0 0 57.5%;
  overflow: hidden;
  background: #0a0906;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* HUD overlay sits inside game-view */
#ui-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* ── MIDDLE: info / dialogue panel (27.5% — 10% taller, game-view reduced) ── */
#info-panel {
  position: relative;
  flex: 0 0 27.5%;
  overflow: hidden;
  display: flex;
  align-items: stretch;

  background:
    linear-gradient(to bottom,
      rgba(20,16,10,0.99) 0%,
      rgba(14,11,7,1)     100%);
  border-top: 1px solid rgba(200,175,130,0.18);
  box-shadow: 0 -6px 24px rgba(0,0,0,0.55);

  /* Left accent line — changes colour between ambient/dialogue via transition */
  --accent-color: var(--ochre-pale, #e8cc78);
}

/* Accent bar on left edge */
#info-panel::before {
  content: '';
  position: absolute;
  left: 0; top: 12%; bottom: 12%;
  width: 2px;
  background: linear-gradient(to bottom, transparent, var(--accent-color), transparent);
  opacity: 0.45;
  transition: background 0.4s ease, opacity 0.4s ease;
}

/* Dialogue mode: teal accent + fixed overlay so text can extend over button bar */
#info-panel.has-dialogue {
  --accent-color: #4af0c0;
}
#info-panel.has-dialogue::before {
  opacity: 0.6;
}
#info-panel.has-dialogue #dialogue-box {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-height: 52dvh;
  overflow: hidden;
  z-index: 50;
  background: linear-gradient(to bottom, rgba(18,14,9,0.99) 0%, rgba(8,6,4,1) 100%);
  border-top: 1px solid rgba(74,240,192,0.32);
  box-shadow: 0 -6px 28px rgba(0,0,0,0.8);
  padding: 10px 14px 10px 12px;
}

/* ── BOTTOM: button bar (15% — reduced 25% from original 20%) ── */
#button-bar {
  flex: 0 0 15%;
  display: flex;
  align-items: stretch;
  gap: 0;

  background:
    linear-gradient(to bottom,
      rgba(12,10,6,0.99) 0%,
      rgba(8,6,4,1)      100%);
  border-top: 1px solid rgba(200,175,130,0.12);
}

/* ════════════════════════════════════════
   BUTTON BAR — "Steinmetz-Konsole"
   Embossed stone slab keys, Swiss dialect
   ════════════════════════════════════════ */
.gbar-btn {
  /* Structure */
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  position: relative;
  overflow: hidden;

  /* Carved stone surface — light from top-left */
  background:
    linear-gradient(145deg,
      rgba(42,34,22,0.95) 0%,
      rgba(28,22,14,0.98) 45%,
      rgba(18,14,8,1)     100%);
  border-right: 1px solid rgba(0,0,0,0.5);

  /* Embossed edge: bright top, dark bottom */
  box-shadow:
    inset 0  1px 0 rgba(220,190,130,0.18),  /* top highlight */
    inset 0 -1px 0 rgba(0,0,0,0.6),          /* bottom shadow */
    inset 1px 0 0 rgba(200,175,120,0.08),    /* left highlight */
    inset -1px 0 0 rgba(0,0,0,0.4);          /* right shadow */

  /* Typography */
  font-family: 'Cinzel', 'Palatino Linotype', serif;
  font-size: clamp(18px, 4.8vw, 28px);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;

  transition: box-shadow 0.07s ease, background 0.07s ease, transform 0.07s ease;
}

.gbar-btn:last-child { border-right: none; }

/* Stone grain texture overlay */
.gbar-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    92deg,
    transparent 0px,
    transparent 3px,
    rgba(255,255,255,0.012) 3px,
    rgba(255,255,255,0.012) 4px
  );
  pointer-events: none;
}

/* ── Button labels & icons ── */
.gbar-icon {
  font-size: clamp(28px, 8vw, 44px);
  line-height: 1;
  display: block;
}

.gbar-label {
  font-size: clamp(14px, 3.6vw, 20px);
  letter-spacing: 0.12em;
  opacity: 0.7;
  display: block;
}

/* ── Per-button stone tints ── */
/* Bewegung — basalt blue-grey */
.gbar-move {
  color: #8faac8;
}
.gbar-move .gbar-icon { font-size: clamp(32px, 10vw, 56px); }

/* Gump — moss sandstone green */
.gbar-jump {
  color: #8cb888;
  background:
    linear-gradient(145deg,
      rgba(30,42,26,0.96) 0%,
      rgba(20,30,18,0.98) 50%,
      rgba(12,20,10,1)    100%);
}

/* Chartä — ochre parchment gold */
.gbar-map {
  color: #c8a850;
  background:
    linear-gradient(145deg,
      rgba(42,34,14,0.96) 0%,
      rgba(30,24,10,0.98) 50%,
      rgba(18,14,6,1)     100%);
}

/* Redä — Rhine quartz blue */
.gbar-interact {
  color: #70b8d8;
  background:
    linear-gradient(145deg,
      rgba(18,30,42,0.96) 0%,
      rgba(12,22,32,0.98) 50%,
      rgba(6,14,22,1)     100%);
}

/* ── PRESSED state: slab sinks into the surface ── */
.gbar-btn.tc-pressed,
.gbar-btn:active {
  transform: translateY(1px);
  box-shadow:
    inset 0  2px 4px rgba(0,0,0,0.7),    /* deep pressed shadow */
    inset 0 -1px 0 rgba(220,190,130,0.1), /* faint bottom light reversal */
    inset 1px 0 2px rgba(0,0,0,0.4),
    inset -1px 0 0 rgba(220,190,130,0.06);
}

.gbar-move.tc-pressed,     .gbar-move:active     { color: #b0d0f0; }
.gbar-jump.tc-pressed,     .gbar-jump:active     { color: #a0e098; }
.gbar-map.tc-pressed,      .gbar-map:active      { color: #e8c860; }
.gbar-interact.tc-pressed, .gbar-interact:active { color: #90d8f8; }

/* Glow bloom on press */
.gbar-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.1s;
  pointer-events: none;
}
.gbar-jump::before     { background: radial-gradient(ellipse at 50% 80%, rgba(80,180,60,0.12), transparent 70%); }
.gbar-map::before      { background: radial-gradient(ellipse at 50% 80%, rgba(200,160,40,0.12), transparent 70%); }
.gbar-interact::before { background: radial-gradient(ellipse at 50% 80%, rgba(40,140,200,0.12), transparent 70%); }
.gbar-move::before     { background: radial-gradient(ellipse at 50% 80%, rgba(80,120,180,0.10), transparent 70%); }
.gbar-btn.tc-pressed::before, .gbar-btn:active::before { opacity: 1; }

/* ── OVERLAY (full-screen, above everything) ── */
#overlay-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
}

/* ── SAFE AREA (notch / home-bar on modern phones) ── */
#game-view {
  padding-top: env(safe-area-inset-top, 0px);
}
#button-bar {
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left:   env(safe-area-inset-left,   0px);
  padding-right:  env(safe-area-inset-right,  0px);
}

/* ── LOADING SCREEN ── */
#loading-screen {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: #080604;
  display: flex;
  align-items: center;
  justify-content: center;
}
#loading-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
#loading-icon {
  animation: loading-pulse 1.1s ease-in-out infinite;
}
#loading-text {
  font-family: 'Share Tech Mono', 'Courier New', monospace;
  font-size: 11px;
  letter-spacing: .32em;
  color: rgba(74, 240, 192, 0.45);
}
@keyframes loading-pulse {
  0%, 100% { opacity: 0.35; transform: scale(0.92); }
  50%       { opacity: 1;    transform: scale(1.06); }
}

.hidden { display: none !important; }
