/* ═══════════════════════════════════════════════════════
   HORMUZ CRISIS — 石油帝国旧纸张线稿风格
   ═══════════════════════════════════════════════════════ */
:root {
  --bg:          #0A0A0F;
  --bg2:         #0F0F1A;
  --bg3:         #161628;
  --panel:       rgba(20, 20, 34, 0.82);
  --panel2:      rgba(28, 28, 48, 0.92);
  --border:      rgba(200, 151, 42, 0.25);
  --border2:     rgba(200, 151, 42, 0.5);
  --border3:     rgba(200, 151, 42, 0.12);
  --gold:        #C8972A;
  --gold-dim:    #8A6520;
  --gold-bright: #E8B040;
  --red-warm:    #C0342C;
  --green-mil:   #2E8A50;
  --green-light: #3DAA62;
  --cyan-cool:   #3A7A90;
  --white-warm:  #EEE4C8;
  --gray-warm:   #B8B4A0;
  --rust:        #D66A58;
  --peach:       #E8A020;
  --cream:       #161628;
  --font-main:   'Cinzel', 'VT323', serif;
  --font-mono:   'DM Mono', 'Share Tech Mono', monospace;
  --font-pixel:  'Cinzel Decorative', 'Press Start 2P', serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; min-height: 100%;
  background: var(--bg);
  color: var(--white-warm);
  font-family: var(--font-main);
  font-size: 18px;
  overflow: hidden;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

/* ─── SCREEN ─── */
.screen { display: none; position: relative; width: 100%; height: 100vh; height: 100dvh; overflow: hidden; }
.screen.active { display: flex; flex-direction: column; }
@keyframes char-bob { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-6px)} }

/* ═══════════════ TITLE ═══════════════ */
#title-screen {
  position: relative;
  background: #05050E;
  align-items: center; justify-content: center;
  overflow: hidden;
}
#title-bg-canvas {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 0;
}
.title-content { display: flex; flex-direction: column; align-items: center; gap: 20px; text-align: center; z-index: 10; position: relative; }
.title-footer a { color: inherit; }
.title-logo { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.title-main { margin: 0; font-size: 64px; line-height: 0.9; color: var(--gold); text-shadow: 0 0 30px rgba(200,151,42,0.7), 0 0 80px rgba(200,151,42,0.25), 0 2px 4px rgba(0,0,0,0.8); letter-spacing: 8px; font-weight: 700; }
.title-sub { font-size: 32px; letter-spacing: 14px; color: var(--gold-dim); opacity: 0.75; }
.title-cn { font-size: 18px; color: var(--white-warm); letter-spacing: 4px; opacity: 0.7; font-family: var(--font-mono); }
.title-tagline { font-size: 13px; color: var(--gray-warm); letter-spacing: 3px; font-family: var(--font-mono); text-transform: uppercase; }
.pixel-tanker-large { display: none; }  /* replaced by canvas scene */
@keyframes tanker-bob { 0%,100%{transform:translateY(0) rotate(-1deg)} 50%{transform:translateY(-6px) rotate(1deg)} }

.title-menu { display: flex; flex-direction: column; gap: 8px; width: 300px; }
.menu-btn {
  background: rgba(20, 20, 34, 0.78);
  border: 1px solid rgba(200, 151, 42, 0.42);
  box-shadow: 0 4px 24px rgba(0,0,0,0.4), inset 0 1px 0 rgba(200,151,42,0.1);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--gold); font-family: var(--font-main);
  padding: 10px 22px 10px; cursor: pointer; letter-spacing: 1px; transition: all 0.2s ease;
  text-align: left; border-radius: 4px;
  display: flex; flex-direction: column; gap: 1px;
  min-height: 44px;
}
.menu-btn:hover { background: rgba(200,151,42,0.12); border-color: var(--gold); color: var(--gold-bright); transform: translateY(-1px); box-shadow: 0 6px 28px rgba(0,0,0,0.5), 0 0 20px rgba(200,151,42,0.18), inset 0 1px 0 rgba(200,151,42,0.25); }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--gold-bright); outline-offset: 3px; }
.btn-cn { font-size: 19px; line-height: 1.2; }
.btn-en { font-size: 11px; color: #C7AA68; letter-spacing: 2px; font-family: var(--font-mono); text-transform: uppercase; font-weight: 500; }
.menu-btn:hover .btn-en { color: rgba(232,176,64,0.75); }
.lang-toggle { text-align: center; font-size: 14px; letter-spacing: 2px; color: var(--gray-warm); border-color: rgba(200,151,42,0.2); margin-top: 2px; flex-direction: row; justify-content: center; }
.lang-toggle:hover { color: var(--gold-bright); border-color: rgba(200,151,42,0.5); }

.title-footer { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 16px; width: min(88vw, 320px); font-size: 14px; color: var(--gray-warm); font-family: var(--font-mono); }

/* ═══════════════ HOW-TO / CLAN ═══════════════ */
#howto-screen, #clan-screen { background: var(--bg); align-items: center; justify-content: center; }
.howto-content, .clan-content { padding: 32px; max-width: 700px; width: 90%; z-index: 10; overflow-y: auto; max-height: 100vh; max-height: 100dvh; }
.howto-title { font-size: 38px; text-align: center; color: var(--gold); text-shadow: 2px 2px 0 var(--peach); margin-bottom: 28px; }
.howto-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 28px; }
.howto-section { background: var(--panel); border: 2px solid var(--border2); box-shadow: 2px 2px 0 rgba(120,90,50,0.15); padding: 16px; }
.howto-section h3 { font-size: 20px; color: var(--gold); margin-bottom: 10px; }
.howto-section p { font-family: var(--font-mono); font-size: 13px; color: var(--white-warm); line-height: 1.6; }
.highlight { color: var(--rust); font-weight: bold; }

.clan-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; max-height: 50vh; overflow-y: auto; }
.clan-entry { background: var(--panel); border: 2px solid var(--border); box-shadow: 1px 1px 0 rgba(120,90,50,0.1); padding: 10px 14px; display: flex; align-items: center; gap: 12px; }
.clan-entry .de-gen { font-size: 24px; color: var(--gold); min-width: 40px; }
.clan-entry .de-info { font-family: var(--font-mono); font-size: 13px; color: var(--white-warm); line-height: 1.4; }
.clan-entry .de-cause { color: var(--red-warm); font-size: 12px; }
.clan-stats { font-family: var(--font-mono); font-size: 14px; color: var(--gray-warm); margin-bottom: 20px; text-align: center; }

/* ═══════════════ GAME SCREEN ═══════════════ */
#game-screen {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(200,151,42,0.04) 0%, transparent 50%),
    var(--bg);
  height: 100vh; height: 100dvh;
}

/* ─── RESOURCE BARS ─── */
.resource-bars {
  display: flex; justify-content: center; gap: 10px;
  padding: 10px 16px;
  background: rgba(0,0,0,0.5);
  border-bottom: 1px solid rgba(200,151,42,0.15);
  backdrop-filter: blur(8px);
  flex-shrink: 0;
}
.res-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  flex: 1; max-width: 90px;
}
.res-icon { font-size: 20px; filter: drop-shadow(0 2px 6px rgba(200,151,42,0.3)); }
.res-bar {
  width: 100%; height: 5px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden; position: relative;
}
.res-fill {
  height: 100%; transition: width 0.55s cubic-bezier(0.4,0,0.2,1);
  background: var(--green-mil);
  position: relative;
  border-radius: 3px;
  box-shadow: 0 0 6px currentColor;
}
.res-fill.warn { background: var(--gold); box-shadow: 0 0 8px rgba(200,151,42,0.6); }
.res-fill.danger { background: var(--red-warm); animation: bar-heartbeat 0.8s ease infinite; box-shadow: 0 0 10px rgba(192,52,44,0.7); }
@keyframes bar-heartbeat { 0%,100%{opacity:1} 50%{opacity:0.55} }
.res-label { font-size: 11px; font-family: var(--font-mono); color: var(--gray-warm); letter-spacing: 0.5px; }

/* Era transition flash */
.effect-flash.gold { background: rgba(192,136,64,0.25); }
.era-badge {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  font-family: var(--font-pixel); font-size: 10px; color: var(--gold);
  text-shadow: 1px 1px 0 var(--peach); letter-spacing: 2px;
  animation: era-pop 1.5s ease-out forwards; pointer-events: none; z-index: 100;
}
@keyframes era-pop { 0%{opacity:0;transform:translate(-50%,-50%) scale(0.5)} 20%{opacity:1;transform:translate(-50%,-50%) scale(1.2)} 40%{transform:translate(-50%,-50%) scale(1)} 100%{opacity:0;transform:translate(-50%,-60%) scale(1)} }

/* Highlight dots showing which bars are affected */
.res-item.hint-active .res-icon { animation: icon-bounce 0.4s ease; }
.res-item.hint-active .res-bar { border-color: var(--gold); box-shadow: 0 0 6px rgba(192,136,64,0.4); }
@keyframes icon-bounce { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-4px)} }

/* ─── CARD ZONE ─── */
.card-zone {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  position: relative; overflow: hidden;
  padding: 16px;
}

/* Character */
.card-character {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  margin-bottom: 16px; opacity: 0; transform: translateY(10px);
  transition: all 0.3s ease;
}
.card-character.visible { opacity: 1; transform: translateY(0); }
.char-emoji { font-size: 48px; filter: drop-shadow(0 4px 14px rgba(200,151,42,0.35)); }
.char-name { font-size: 16px; font-family: var(--font-mono); color: var(--gold); }

/* Card wrapper (for drag) */
.card-wrapper {
  position: relative; width: 300px; max-width: 85vw;
  cursor: grab; touch-action: none;
}
.card-wrapper:active { cursor: grabbing; }

/* Card */
.card {
  background: rgba(12, 12, 22, 0.92);
  border: 1px solid rgba(200, 151, 42, 0.5);
  box-shadow: 0 10px 48px rgba(0,0,0,0.65), 0 0 24px rgba(200,151,42,0.08), inset 0 1px 0 rgba(200,151,42,0.12);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 0;
  min-height: 140px;
  display: flex; flex-direction: column;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  position: relative; z-index: 2;
  overflow: hidden;
  border-radius: 10px;
}
.card-illust {
  width: 100%; height: 100px;
  background: var(--bg3);
  border-bottom: 1px solid rgba(200,151,42,0.2);
  overflow: hidden;
  border-radius: 10px 10px 0 0;
}
#card-canvas { width: 100%; height: 100%; display: block; }
.card-body { padding: 16px 20px; flex: 1; display: flex; align-items: center; justify-content: center; }
.card.dragging { transition: none; }
.card.fly-left { transition: transform 0.4s ease, opacity 0.4s ease; transform: translateX(-150%) rotate(-18deg); opacity: 0; }
.card.fly-right { transition: transform 0.4s ease, opacity 0.4s ease; transform: translateX(150%) rotate(18deg); opacity: 0; }
.card.entering { animation: card-enter 0.38s cubic-bezier(0.175,0.885,0.32,1.275); }
@keyframes card-enter { from{transform:scale(0.75) translateY(24px);opacity:0} to{transform:scale(1) translateY(0);opacity:1} }

/* Card shake on danger */
.card.shake { animation: card-shake 0.4s ease; }
@keyframes card-shake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-6px) rotate(-1deg)} 40%{transform:translateX(6px) rotate(1deg)} 60%{transform:translateX(-4px)} 80%{transform:translateX(4px)} }

/* Swipe glow trail */
.card-wrapper::after {
  content: ''; position: absolute; inset: -4px; z-index: 0;
  border-radius: 4px; opacity: 0; transition: opacity 0.2s;
  pointer-events: none;
}
.card-wrapper.glow-left::after { opacity: 1; box-shadow: -12px 0 32px rgba(46,138,80,0.45); }
.card-wrapper.glow-right::after { opacity: 1; box-shadow: 12px 0 32px rgba(192,52,44,0.45); }

.card-body { text-align: center; }
.card-text {
  font-size: 20px; line-height: 1.5;
  color: var(--white-warm);
}

/* Swipe hints */
.swipe-hint {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(12,12,22,0.85);
  border: 1px solid rgba(200,151,42,0.45);
  backdrop-filter: blur(10px);
  padding: 7px 12px;
  font-size: 16px; color: var(--gold);
  white-space: nowrap;
  opacity: 0; transition: opacity 0.15s;
  pointer-events: none; z-index: 1;
  border-radius: 4px;
}
.swipe-hint.left { right: calc(100% + 12px); }
.swipe-hint.right { left: calc(100% + 12px); }
.swipe-hint.visible { opacity: 1; }

/* Hint preview → replaced by choice bar */

/* ─── CHOICE BAR (always visible below card) ─── */
.choice-bar {
  display: flex; gap: 12px; width: 300px; max-width: 85vw;
  margin-top: 14px;
}
.choice-btn {
  flex: 1; display: flex; align-items: center; gap: 6px;
  padding: 12px 14px;
  background: rgba(16,16,28,0.8);
  border: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-family: var(--font-main); font-size: 16px;
  color: var(--white-warm); cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1.3;
  border-radius: 6px;
}
.choice-btn:hover, .choice-btn:active { transform: translateY(-2px); }
.choice-left { justify-content: flex-start; text-align: left; border-color: rgba(46,138,80,0.3); }
.choice-right { justify-content: flex-end; text-align: right; border-color: rgba(192,52,44,0.3); }
.choice-left:hover { border-color: var(--green-mil); color: var(--green-light); background: rgba(46,138,80,0.18); box-shadow: 0 0 20px rgba(46,138,80,0.18); }
.choice-right:hover { border-color: var(--red-warm); color: #E04848; background: rgba(192,52,44,0.18); box-shadow: 0 0 20px rgba(192,52,44,0.18); }
.choice-left.active { background: rgba(46,138,80,0.22); border-color: var(--green-mil); color: var(--green-light); box-shadow: 0 0 24px rgba(46,138,80,0.22); }
.choice-right.active { background: rgba(192,52,44,0.22); border-color: var(--red-warm); color: #E04848; box-shadow: 0 0 24px rgba(192,52,44,0.22); }
.choice-arrow { font-size: 18px; opacity: 0.7; flex-shrink: 0; }
.choice-text { font-size: 14px; }

/* ─── BOTTOM BAR ─── */
.bottom-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: rgba(0,0,0,0.5);
  border-top: 1px solid rgba(200,151,42,0.15);
  backdrop-filter: blur(8px);
  flex-shrink: 0;
}
.tycoon-info { display: flex; align-items: center; gap: 8px; }
.tycoon-emoji { font-size: 20px; }
.tycoon-name { font-size: 14px; color: var(--gold); font-family: var(--font-mono); letter-spacing: 0.5px; }
.reign-info { display: flex; align-items: center; gap: 6px; }
.tenure-label { font-size: 12px; color: var(--gray-warm); font-family: var(--font-mono); }
.tenure-count { font-size: 18px; color: var(--white-warm); }
.icon-btn {
  background: rgba(20,20,34,0.8); border: 1px solid rgba(200,151,42,0.3);
  color: var(--gold-bright); font-size: 16px; width: 44px; height: 44px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px; transition: all 0.2s;
}
.icon-btn:hover { border-color: var(--gold); color: var(--gold); background: rgba(200,151,42,0.1); }

/* ═══════════════ DEATH ═══════════════ */
.modal { position: fixed; inset: 0; z-index: 5000; display: flex; align-items: center; justify-content: center; overflow-y: auto; padding: 16px; background: rgba(0,0,0,0.75); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.modal.hidden { display: none; }
.modal:focus { outline: none; }

.death-card {
  background: rgba(10, 8, 14, 0.96);
  border: 1px solid rgba(192, 52, 44, 0.55);
  box-shadow: 0 0 60px rgba(192,52,44,0.18), 0 20px 80px rgba(0,0,0,0.8), inset 0 1px 0 rgba(192,52,44,0.12);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: 12px;
  padding: 32px; min-width: 320px; max-width: 90vw; max-height: calc(100dvh - 32px); overflow-y: auto; text-align: center;
  animation: death-enter 0.5s cubic-bezier(0.175,0.885,0.32,1.275);
}
@keyframes death-enter { from{transform:scale(0.5);opacity:0} to{transform:scale(1);opacity:1} }
.death-emoji { font-size: 64px; margin-bottom: 16px; }
.death-title { font-size: 32px; color: var(--red-warm); text-shadow: 1px 1px 0 var(--peach); margin-bottom: 10px; }
.death-text { font-size: 17px; font-family: var(--font-mono); color: var(--white-warm); line-height: 1.6; margin-bottom: 20px; max-width: 400px; }
.death-stats { display: flex; justify-content: center; gap: 20px; margin-bottom: 24px; }
.death-stat { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.death-stat-label { font-size: 12px; font-family: var(--font-mono); color: var(--gray-warm); }
.death-stat-value { font-size: 28px; color: var(--gold); }
.death-actions { display: flex; flex-direction: column; gap: 10px; }
.death-btn { text-align: center !important; font-size: 22px !important; }
.death-btn.secondary { color: var(--gray-warm) !important; font-size: 18px !important; }

/* ── Share Module ── */
.share-module {
  margin-top: 16px; padding-top: 14px;
  border-top: 1px dashed var(--border);
  text-align: center;
}
.share-label {
  font-size: 16px; color: var(--gold); margin-bottom: 8px;
  letter-spacing: 1px;
}
.share-text {
  font-family: var(--font-mono); font-size: 12px;
  color: var(--white-warm); background: var(--bg3);
  border: 1px solid var(--border); padding: 10px 12px;
  line-height: 1.5; text-align: left; margin-bottom: 10px;
  max-height: 80px; overflow-y: auto; word-break: break-word;
}
.share-buttons {
  display: flex; gap: 8px; justify-content: center;
}
.share-btn {
  flex: 1; padding: 8px 10px;
  background: var(--panel); border: 2px solid var(--border2);
  box-shadow: 1px 1px 0 rgba(120,90,50,0.15);
  font-family: var(--font-main); font-size: 16px;
  color: var(--gold); cursor: pointer;
  transition: all 0.15s; letter-spacing: 1px;
}
.share-btn:hover {
  background: var(--panel2); border-color: var(--gold);
  color: var(--gold-bright); transform: translateY(-1px);
}
.share-feedback {
  font-family: var(--font-mono); font-size: 12px;
  color: var(--green-mil); height: 18px; margin-top: 6px;
}

/* ═══════════════ PAUSE ═══════════════ */
.pause-box {
  background: var(--cream); border: 2px solid var(--border2);
  box-shadow: 4px 4px 0 rgba(120,90,50,0.25);
  padding: 28px; text-align: center; width: 280px;
  display: flex; flex-direction: column; gap: 10px;
}
.pause-box .menu-btn { text-align: center; }
.modal-title { font-size: 26px; color: var(--gold); text-shadow: 1px 1px 0 var(--peach); margin-bottom: 10px; }
.reset-btn { color: var(--red-warm); font-size: 16px; }

/* ═══════════════ EFFECTS ═══════════════ */
.effects-layer { position: fixed; inset: 0; z-index: 6000; pointer-events: none; }
.effect-flash { position: fixed; inset: 0; animation: flash-warm 0.4s forwards; pointer-events: none; }
.effect-flash.red { background: rgba(208,90,58,0.2); }
.effect-flash.green { background: rgba(90,154,88,0.15); }
.effect-flash.gold { background: rgba(192,136,64,0.15); }
@keyframes flash-warm { 0%{opacity:1} 100%{opacity:0} }

.bar-change-indicator {
  position: absolute; font-size: 14px; font-family: var(--font-main);
  animation: change-pop 0.8s ease-out forwards;
  pointer-events: none; z-index: 10;
  text-shadow: 1px 1px 0 rgba(255,248,232,0.8);
}
@keyframes change-pop { 0%{transform:translateY(0) scale(1);opacity:1} 50%{transform:translateY(-12px) scale(1.2);opacity:0.8} 100%{transform:translateY(-28px) scale(1);opacity:0} }

/* Sound feedback visual pulse (replaces actual sound) */
.sfx-pulse {
  position: fixed; bottom: 20px; right: 20px; width: 40px; height: 40px;
  border-radius: 50%; pointer-events: none; z-index: 7000;
  animation: sfx-ring 0.6s ease-out forwards;
}
.sfx-pulse.positive { background: radial-gradient(circle, rgba(90,154,88,0.4) 0%, transparent 70%); }
.sfx-pulse.negative { background: radial-gradient(circle, rgba(208,90,58,0.4) 0%, transparent 70%); }
.sfx-pulse.neutral { background: radial-gradient(circle, rgba(192,136,64,0.3) 0%, transparent 70%); }
@keyframes sfx-ring { 0%{transform:scale(0.5);opacity:1} 100%{transform:scale(3);opacity:0} }

/* ═══════════════ UTILS ═══════════════ */
.hidden { display: none !important; }
.intel-placeholder { font-family: var(--font-mono); font-size: 14px; color: var(--gray-warm); text-align: center; padding: 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.full-width-btn { width: 100%; text-align: center; align-items: center; }
.form-error, .name-error { min-height: 20px; margin: -8px 0 10px; color: #FF8A7A; font: 13px/1.4 var(--font-mono); }
.leaderboard-back-top { position: absolute; top: 20px; left: 20px; z-index: 10; }

/* ═══════════════ FIRST CHOICE HINT ═══════════════ */
.tutorial-hint {
  width: min(85vw, 420px); margin-top: 10px; padding: 8px 12px;
  border: 1px solid var(--gold); border-radius: 4px;
  background: rgba(10,10,15,0.88); color: var(--white-warm);
  font: 13px/1.5 var(--font-mono); text-align: center;
}

/* ═══════════════ MOBILE ═══════════════ */
@media screen and (max-width: 500px) {
  .title-main { font-size: 44px; letter-spacing: 3px; }
  .title-sub { font-size: 28px; letter-spacing: 10px; }
  .title-menu { width: 88vw; }
  .menu-btn { font-size: 20px; padding: 14px 18px; min-height: 52px; }
  .howto-grid { grid-template-columns: 1fr; }
  .resource-bars { gap: 8px; padding: 10px 8px; }
  .res-icon { font-size: 18px; }
  .res-label { font-size: 10px; }
  .card-wrapper { width: 80vw; }
  .card-text { font-size: 18px; }
  .char-emoji { font-size: 40px; }
  .swipe-hint { font-size: 14px; padding: 6px 10px; }
  .death-card { padding: 20px; }
  .death-emoji { font-size: 48px; }
  .death-title { font-size: 24px; }
}

@media screen and (max-height: 620px) {
  #title-screen, #howto-screen, #clan-screen, #leaderboard-screen { overflow-y: auto; justify-content: flex-start; }
  .title-content { padding: 24px 0; margin: auto; }
  .title-logo { gap: 3px; }
  .title-main { font-size: 40px; }
  .title-sub { font-size: 22px; }
  .card-zone { padding: 6px 12px; }
  .card-character { margin-bottom: 4px; }
  .char-emoji { font-size: 32px; }
  .card-illust { height: 72px; }
  .card { min-height: 120px; }
  .choice-bar { margin-top: 6px; }
  .leaderboard-content { min-height: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* ═══════════════ ENHANCEMENT SYSTEMS CSS ═══════════════ */

/* ── Result Narrative ── */
.result-fade { opacity: 0; transition: opacity 0.3s; }
.result-show { animation: resultFadeIn 0.4s ease forwards; }
.result-text { font-style: italic; line-height: 1.6; }
.result-positive { color: var(--green-mil); }
.result-negative { color: var(--red-warm); }
.result-mixed { color: var(--gold-bright); }
@keyframes resultFadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* ── Crisis Danger Zones ── */
.res-item.danger .res-fill { animation: dangerPulse 1.2s ease-in-out infinite; }
.res-item.danger .res-icon { animation: iconBounce 1.2s ease infinite; }
.res-item.critical .res-fill { animation: criticalPulse 0.6s ease-in-out infinite; }
.res-item.critical .res-icon { animation: iconBounce 0.6s ease infinite; transform-origin: center; }
.res-item.critical .res-label { color: var(--red-warm); font-weight: bold; }
@keyframes dangerPulse { 0%,100% { opacity: 1; } 50% { opacity: 0.6; } }
@keyframes criticalPulse { 0%,100% { opacity: 1; box-shadow: 0 0 8px rgba(208,90,58,0.6); } 50% { opacity: 0.7; box-shadow: 0 0 16px rgba(208,90,58,0.9); } }
@keyframes iconBounce { 0%,100% { transform: scale(1); } 50% { transform: scale(1.3); } }

/* ── Screen Danger Vignette ── */
.danger-vignette::after { content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 90;
  box-shadow: inset 0 0 60px rgba(208,90,58,0.15); animation: vignetteFlash 2s ease infinite; }
.crisis-vignette::after { content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 90;
  box-shadow: inset 0 0 80px rgba(200,50,30,0.3); animation: vignetteFlash 1s ease infinite; }
@keyframes vignetteFlash { 0%,100% { opacity: 0.5; } 50% { opacity: 1; } }

/* ── Crisis Warning Banner ── */
.crisis-warning {
  position: fixed; top: 80px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(135deg, #d05a3a, #a03020); color: #fff; padding: 10px 24px;
  font-family: var(--font-main); font-size: 22px; letter-spacing: 2px; z-index: 200;
  border: 2px solid #ff6040; box-shadow: 0 4px 20px rgba(200,50,30,0.5);
  animation: warningSlide 0.4s ease, warningPulse 0.8s ease 0.4s infinite;
}
@keyframes warningSlide { from { transform: translateX(-50%) translateY(-30px); opacity: 0; } to { transform: translateX(-50%) translateY(0); opacity: 1; } }
@keyframes warningPulse { 0%,100% { box-shadow: 0 4px 20px rgba(200,50,30,0.5); } 50% { box-shadow: 0 4px 30px rgba(255,80,40,0.8); } }

/* ── Milestone Overlay ── */
.milestone-overlay {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.5); z-index: 500; opacity: 0; transition: opacity 0.5s;
}
.milestone-overlay.show { opacity: 1; }
.milestone-card {
  background: linear-gradient(135deg, var(--cream), var(--peach));
  border: 3px solid var(--gold); padding: 30px 40px; text-align: center;
  box-shadow: 0 8px 40px rgba(160,112,48,0.4); animation: milestoneZoom 0.5s ease;
}
.milestone-title { font-family: var(--font-main); font-size: 36px; color: var(--gold); margin-bottom: 8px; }
.milestone-desc { font-family: var(--font-mono); font-size: 18px; color: var(--gray-warm); }
@keyframes milestoneZoom { from { transform: scale(0.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ── NPC Reputation Badge ── */
.npc-rep-badge {
  position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%);
  padding: 10px 20px; font-family: var(--font-main); font-size: 20px; z-index: 150;
  animation: repBadgeSlide 0.4s ease, repBadgeFade 2.5s ease forwards;
}
.npc-rep-badge.loyalty { background: var(--green-mil); color: #fff; border: 2px solid var(--green-light); }
.npc-rep-badge.betrayal { background: var(--red-warm); color: #fff; border: 2px solid #ff6040; }
@keyframes repBadgeSlide { from { transform: translateX(-50%) translateY(20px); opacity: 0; } to { transform: translateX(-50%); opacity: 1; } }
@keyframes repBadgeFade { 0%,70% { opacity: 1; } 100% { opacity: 0; } }

/* ── Boss Event Overlay ── */
.boss-overlay {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(30,10,5,0.8); z-index: 600; opacity: 0; transition: opacity 0.3s;
}
.boss-overlay.show { opacity: 1; }
.boss-title {
  font-family: var(--font-main); font-size: 42px; color: #ff4020;
  text-shadow: 0 0 20px rgba(255,60,20,0.6), 0 0 40px rgba(255,60,20,0.3);
  letter-spacing: 6px; animation: bossFlash 0.3s ease infinite alternate;
}
@keyframes bossFlash { from { opacity: 0.7; } to { opacity: 1; } }

/* ── Legacy Perk Overlay ── */
.legacy-overlay {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.6); z-index: 550; opacity: 0; transition: opacity 0.5s;
}
.legacy-overlay.show { opacity: 1; }
.legacy-card {
  background: linear-gradient(135deg, #1a1a2e, #16213e); border: 2px solid var(--gold);
  padding: 30px 40px; text-align: center;
  box-shadow: 0 0 40px rgba(160,112,48,0.3), inset 0 0 20px rgba(160,112,48,0.1);
  animation: legacyZoom 0.6s ease;
}
.legacy-header { font-family: var(--font-mono); font-size: 16px; color: var(--gold); margin-bottom: 12px; letter-spacing: 2px; }
.legacy-title { font-family: var(--font-main); font-size: 36px; color: #fff; margin-bottom: 8px; }
.legacy-desc { font-family: var(--font-mono); font-size: 18px; color: var(--peach); }
@keyframes legacyZoom { from { transform: scale(0.3) rotate(-10deg); opacity: 0; } to { transform: scale(1) rotate(0); opacity: 1; } }

/* ── Screen Shake ── */
@keyframes shake {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-3px, -2px); }
  20% { transform: translate(4px, 1px); }
  30% { transform: translate(-2px, 3px); }
  40% { transform: translate(3px, -1px); }
  50% { transform: translate(-1px, 2px); }
  60% { transform: translate(2px, -3px); }
  70% { transform: translate(-4px, 1px); }
  80% { transform: translate(1px, -2px); }
  90% { transform: translate(-2px, 3px); }
}

/* ── Resource Change Particles ── */
.particle {
  position: absolute; font-family: var(--font-main); font-size: 16px; font-weight: bold;
  pointer-events: none; z-index: 10; opacity: 0;
}
.particle-up { color: var(--green-mil); animation: particleUp 0.8s ease forwards; }
.particle-down { color: var(--red-warm); animation: particleDown 0.8s ease forwards; }
@keyframes particleUp { 0% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; transform: translateY(-25px); } }
@keyframes particleDown { 0% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; transform: translateY(20px); } }

/* ── Resource Change Number ── */
.change-number {
  position: absolute; right: -5px; top: -15px; font-family: var(--font-main); font-size: 20px;
  font-weight: bold; pointer-events: none; z-index: 10;
  animation: changeFloat 1s ease forwards;
}
.change-pos { color: var(--green-mil); }
.change-neg { color: var(--red-warm); }
@keyframes changeFloat { 0% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; transform: translateY(-20px); } }

/* ═══════════════ LEADERBOARD & NAME INPUT ═══════════════ */

/* ── Name Input Modal ── */
.name-card {
  background: linear-gradient(135deg, #1a1a2e, #16213e); border: 2px solid var(--gold);
  padding: 30px; text-align: center; width: 85vw; max-width: 360px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}
.name-title { font-family: var(--font-main); font-size: 24px; color: var(--gold); margin-bottom: 16px; }
.name-score-row { font-family: var(--font-mono); font-size: 18px; color: var(--peach); margin-bottom: 16px; }
.name-score-val { font-size: 28px; color: var(--gold-bright); font-weight: bold; }
.name-input {
  width: 100%; padding: 12px 16px; font-family: var(--font-main); font-size: 20px;
  background: rgba(255,255,255,0.08); border: 2px solid var(--gold); color: #fff;
  text-align: center; outline: none; margin-bottom: 16px; box-sizing: border-box;
}
.name-input::placeholder { color: rgba(255,255,255,0.3); }
.name-input:focus { border-color: var(--gold-bright); box-shadow: 0 0 10px rgba(160,112,48,0.3); }
.name-actions { display: flex; gap: 10px; justify-content: center; }
.name-actions .menu-btn { flex: 1; font-size: 16px; }

/* ── Rank Badge (after submit) ── */
.rank-badge {
  position: fixed; top: 20%; left: 50%; transform: translateX(-50%);
  background: linear-gradient(135deg, var(--gold), #c08040); color: #1a0a00;
  padding: 16px 28px; font-family: var(--font-main); font-size: 22px;
  z-index: 700; box-shadow: 0 8px 30px rgba(160,112,48,0.5);
  opacity: 0; transition: opacity 0.5s;
}
.rank-badge.show { opacity: 1; }

/* ── Leaderboard Screen ── */
.leaderboard-content {
  padding: 20px; max-width: 600px; margin: 0 auto; height: 100vh;
  display: flex; flex-direction: column; box-sizing: border-box;
}
.leaderboard-list {
  flex: 1; overflow-y: auto; margin: 16px 0;
  border: 1px solid rgba(160,112,48,0.2); background: rgba(0,0,0,0.15);
}
.lb-loading, .lb-empty {
  text-align: center; padding: 40px; font-family: var(--font-mono);
  font-size: 18px; color: var(--gray-warm);
}
.lb-header {
  display: flex; padding: 10px 12px; font-family: var(--font-mono); font-size: 14px;
  color: var(--gold); border-bottom: 2px solid var(--gold); background: rgba(160,112,48,0.1);
  position: sticky; top: 0;
}
.lb-row {
  display: flex; padding: 10px 12px; font-family: var(--font-main); font-size: 18px;
  color: var(--white-warm); border-bottom: 1px solid rgba(200,151,42,0.1);
  transition: background 0.2s;
}
.lb-row:hover { background: rgba(160,112,48,0.1); }
.lb-top1 { color: var(--gold-bright); font-size: 20px; background: rgba(255,215,0,0.08); }
.lb-top2 { color: #c0c0c0; font-size: 19px; background: rgba(192,192,192,0.05); }
.lb-top3 { color: #cd7f32; font-size: 19px; background: rgba(205,127,50,0.05); }
.lb-me { background: rgba(90,154,88,0.15) !important; border-left: 3px solid var(--green-mil); }
.lb-rank { width: 50px; text-align: center; }
.lb-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { width: 60px; text-align: right; font-weight: bold; color: var(--gold); }
.lb-gen { width: 40px; text-align: right; color: var(--gray-warm); font-size: 14px; }

/* ═══════════════ VINTAGE PAPER EDITION ═══════════════ */
:root {
  --bg:          #e8dcc0;
  --bg2:         #e2d1ae;
  --bg3:         #d3bc91;
  --panel:       rgba(246, 237, 214, 0.92);
  --panel2:      rgba(239, 226, 195, 0.96);
  --border:      rgba(67, 47, 31, 0.28);
  --border2:     rgba(67, 47, 31, 0.58);
  --border3:     rgba(67, 47, 31, 0.16);
  --gold:        #70482d;
  --gold-dim:    #8b6948;
  --gold-bright: #a45d35;
  --red-warm:    #914331;
  --green-mil:   #5c704d;
  --green-light: #6e815c;
  --cyan-cool:   #527b78;
  --white-warm:  #2f241b;
  --gray-warm:   #6f5d49;
  --rust:        #9c4f32;
  --peach:       #b77843;
  --cream:       #efe2c3;
  --font-main:   'Cinzel', Georgia, serif;
  --font-mono:   'DM Mono', 'Courier New', monospace;
  --font-pixel:  'Cinzel Decorative', 'Cinzel', Georgia, serif;
}

html, body {
  background: var(--bg);
  color: var(--white-warm);
}

body {
  background-image: linear-gradient(rgba(232, 220, 192, 0.88), rgba(232, 220, 192, 0.88)), url('assets/tex_card_paper_vintage.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

#title-screen {
  background: linear-gradient(rgba(239, 226, 195, 0.22), rgba(239, 226, 195, 0.58)), url('assets/bg_hormuz_hero_paper.jpg') center / cover;
}
#title-bg-canvas { display: none; }
.title-content {
  padding: 28px 24px;
  background: rgba(239, 226, 195, 0.78);
  border: 1px solid rgba(67, 47, 31, 0.35);
  box-shadow: 0 18px 50px rgba(47, 36, 27, 0.2), inset 0 0 0 6px rgba(255, 248, 224, 0.22);
  backdrop-filter: blur(2px);
}
.title-main {
  color: var(--white-warm);
  text-shadow: 1px 1px 0 rgba(255, 248, 224, 0.85);
  letter-spacing: 6px;
}
.title-sub { color: var(--gold); opacity: 0.9; }
.title-cn, .title-tagline, .title-footer { color: var(--gray-warm); }
.menu-btn {
  background: rgba(246, 237, 214, 0.88);
  border-color: var(--border2);
  box-shadow: 3px 3px 0 rgba(67, 47, 31, 0.16);
  color: var(--gold);
  backdrop-filter: none;
}
.menu-btn:hover {
  background: var(--cream);
  border-color: var(--gold);
  color: var(--gold-bright);
  box-shadow: 4px 4px 0 rgba(67, 47, 31, 0.2);
}
.btn-en { color: var(--gray-warm); }

#game-screen, #howto-screen, #clan-screen, #leaderboard-screen {
  background: linear-gradient(rgba(232, 220, 192, 0.88), rgba(232, 220, 192, 0.88)), url('assets/tex_card_paper_vintage.jpg') center / cover;
}
.resource-bars, .bottom-bar {
  background: rgba(239, 226, 195, 0.9);
  border-color: var(--border);
  backdrop-filter: blur(3px);
}
.card {
  background: rgba(246, 237, 214, 0.96);
  border: 1px solid var(--border2);
  box-shadow: 5px 7px 0 rgba(67, 47, 31, 0.18), 0 12px 32px rgba(67, 47, 31, 0.16);
  backdrop-filter: none;
  border-radius: 2px;
}
.card-illust {
  background: var(--cream) url('assets/tex_card_paper_vintage.jpg') center / cover no-repeat;
  border-bottom-color: var(--border2);
}
#card-canvas { background: transparent; }
.card-body { background: rgba(246, 237, 214, 0.84); }
.choice-btn, .swipe-hint, .icon-btn {
  background: rgba(246, 237, 214, 0.9);
  border-color: var(--border2);
  color: var(--white-warm);
  backdrop-filter: none;
}
.choice-left, .choice-right { border-color: var(--border2); }
.choice-left:hover, .choice-left.active { background: rgba(92, 112, 77, 0.16); color: var(--green-mil); }
.choice-right:hover, .choice-right.active { background: rgba(145, 67, 49, 0.13); color: var(--red-warm); }
.howto-section, .clan-entry, .pause-box, .name-card, .death-card, .legacy-card, .leaderboard-list {
  background: rgba(246, 237, 214, 0.9);
  border-color: var(--border2);
  box-shadow: 3px 3px 0 rgba(67, 47, 31, 0.15);
  backdrop-filter: none;
}
.modal { background: rgba(47, 36, 27, 0.58); backdrop-filter: blur(3px); }
.name-input { background: rgba(255, 248, 224, 0.78); color: var(--white-warm); }
.name-input::placeholder { color: rgba(47, 36, 27, 0.46); }
.crisis-warning { background: var(--red-warm); border-color: #6e2f25; box-shadow: 3px 3px 0 rgba(67, 47, 31, 0.25); }
.char-emoji, .tycoon-emoji, .death-emoji, .res-icon {
  filter: grayscale(0.85) sepia(0.7) saturate(0.7) contrast(1.08);
}
.boss-overlay, .legacy-overlay, .milestone-overlay {
  background: rgba(47, 36, 27, 0.58);
}
.boss-title {
  color: var(--red-warm);
  text-shadow: 1px 1px 0 rgba(255, 248, 224, 0.8);
  animation: none;
}
.legacy-title { color: var(--white-warm); }
.rank-badge {
  background: var(--gold);
  color: var(--cream);
  box-shadow: 3px 3px 0 rgba(67, 47, 31, 0.22);
}
