/* Ödland — mobile portrait first, scale up gracefully */

@media (max-width: 420px) {
  body { font-size: 15px; }
  .app { max-width: 100%; border-left: none; border-right: none; }
  .day-stage { padding: 10px 12px 14px; gap: 10px; }
  .day-stage .day-controls { margin-left: -12px; margin-right: -12px; padding-left: 12px; padding-right: 12px; }
  .card { padding: 10px 12px 10px; }
  .card-header { gap: 8px; margin-bottom: 4px; }
  .card-stamp { width: 36px; height: 36px; }
  .stamp-glyph { font-size: 20px; }
  .card-title-text { font-size: 16px; }
  .card-flavor { font-size: 12px; min-height: 28px; margin: 2px 0 8px; line-height: 1.4; }
  .choice { font-size: 13px; padding: 6px 8px; min-height: 56px; }
  .choice-label { font-size: 13px; }
  .choice-effects { font-size: 12px; gap: 4px; }
  .hud { padding: 8px 12px 8px; }
  .hud-day { font-size: 18px; }
  .hud-shelter { font-size: 13px; letter-spacing: 0.08em; }
  .hud-pause, .hud-icon-btn { width: 30px; height: 30px; font-size: 16px; }
  .bars { gap: 4px 12px; }
  .bar-label { font-size: 12px; min-width: 44px; letter-spacing: 0.04em; }
  .bar-num { font-size: 14px; }
  .bar-track { height: 12px; }
  .day-headline { font-size: 18px; margin: 0; }
  .day-sub { font-size: 14px; margin-top: -2px; }
  .day-narrative { font-size: 11px; margin-top: -2px; }
  .log { max-height: 60px; font-size: 12px; padding: 6px 8px; }
  .modal { padding: 14px 14px 12px; }
  .modal h2 { font-size: 20px; }
  .toast-stack { top: 70px; }
  .toast { font-size: 12px; padding: 4px 10px; }
  .card-stamp { transform: rotate(-4deg); }
}

@media (max-width: 360px) {
  body { font-size: 14px; }
  .bars { grid-template-columns: 1fr; gap: 4px; }
  .bar-label { min-width: 60px; }
  .card-choices { grid-template-columns: 1fr; gap: 6px; }
  .choice { min-height: 48px; padding: 5px 8px; }
  .card-stamp { width: 32px; height: 32px; }
  .stamp-glyph { font-size: 18px; }
  .card-title-text { font-size: 15px; letter-spacing: 0.03em; }
  .card-flavor { min-height: 24px; }
  .hud-day { font-size: 16px; }
  .hud-shelter { display: none; }
  .day-stage { padding: 8px 10px 12px; }
  .day-stage .day-controls { margin-left: -10px; margin-right: -10px; padding-left: 10px; padding-right: 10px; }
}

@media (max-width: 320px) {
  .card-tag { display: none; }
  .card-title-text { padding-right: 0; }
  .log { max-height: 48px; }
  .toast { font-size: 11px; }
}

@media (max-height: 720px) {
  .day-stage { gap: 8px; }
  .card-flavor { min-height: 22px; margin: 2px 0 6px; }
  .log { max-height: 52px; }
  .hud { padding-bottom: 6px; }
}

@media (max-height: 600px) {
  .day-headline { font-size: 16px; }
  .day-sub { font-size: 12px; }
  .day-narrative { display: none; }
  .card-flavor { display: none; }
  .log { display: none; }
  .card { padding: 8px 10px; }
  .card-header { margin-bottom: 2px; }
}

@media (min-width: 481px) {
  .app {
    margin-top: 12px;
    margin-bottom: 12px;
    min-height: calc(100vh - 24px);
    min-height: calc(100dvh - 24px);
    border-radius: 4px;
  }
}

@media (min-width: 768px) {
  .app { max-width: 540px; }
  .day-stage { padding: 18px 22px 24px; }
}

/* Animations */
.fade-in { animation: fade-in 220ms ease both; }
@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.shake { animation: shake 260ms ease; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
.glow { animation: glow 1.2s ease-in-out infinite alternate; }
@keyframes glow {
  from { box-shadow: 0 0 0 transparent, var(--shadow-deep); }
  to { box-shadow: 0 0 20px rgba(201,162,104,0.4), var(--shadow-deep); }
}

/* Touch-friendly choice targets */
@media (hover: none) {
  .choice:active { background: linear-gradient(180deg, #5a4632 0%, var(--frame-2) 100%); }
}

/* Force focus visible on tab navigation */
button:focus-visible, .choice:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* === Mobile compat hardening pass v=27 === */

/* Firefox Android URL-bar-jump fix: use dvh fallback */
html, body {
  min-height: 100vh;
  min-height: 100dvh;
}

/* Safe-area-inset for iPhone notch + Android gesture-bar */
.app {
  padding-top: env(safe-area-inset-top, 0);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

/* Anti-zoom on input focus (iOS Safari + Firefox Android both zoom <16px inputs) */
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], textarea {
  font-size: 16px;
}

/* backdrop-filter graceful fallback (Firefox Android ignores it) */
@supports not (backdrop-filter: blur(4px)) {
  .modal-backdrop, .modal {
    background: rgba(10, 8, 6, 0.96) !important;
  }
}

/* Tap targets ≥ 36px (Andre rule) — HUD icons were 30px */
@media (max-width: 420px) {
  .hud-pause, .hud-icon-btn {
    width: 36px; height: 36px; font-size: 16px;
    min-width: 36px; min-height: 36px;
  }
  .setting-toggle {
    min-width: 44px; min-height: 24px;
  }
  /* Tag-synergy strip — compact on phones */
  .tag-synergy-strip { font-size: 10px !important; gap: 4px !important; margin: 2px 0 6px !important; }
  .tag-synergy-strip span { padding: 2px 6px !important; }
}

/* Prevent over-scroll body bounce on iOS so the bunker UI feels app-like */
body { overscroll-behavior-y: contain; }
