:root {
  --ink: #102a2b;
  --ink-soft: #284344;
  --cream: #f4eedf;
  --paper: #fffaf0;
  --stone: #c9b992;
  --gold: #d6a739;
  --gold-bright: #f2c75c;
  --rust: #a34c34;
  --green: #315b4b;
  --green-bright: #5f8d6f;
  --sky: #a9cfce;
  --danger: #9b382f;
  --shadow: 0 24px 70px rgba(16, 42, 43, .22);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--ink); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.screen { min-height: 100vh; }
.eyebrow { font-size: 11px; font-weight: 900; letter-spacing: .19em; text-transform: uppercase; color: var(--rust); }

.title-screen {
  position: relative;
  display: grid;
  grid-template-columns: minmax(520px, 1fr) minmax(420px, .88fr);
  overflow: hidden;
  background:
    radial-gradient(circle at 15% 20%, rgba(255,255,255,.72), transparent 35%),
    linear-gradient(135deg, #e8dec4 0 48%, #b9d0c6 48% 100%);
}
.title-card { position: relative; z-index: 2; align-self: center; max-width: 760px; padding: clamp(40px, 7vw, 110px); }
.title-card h1 { margin: 12px 0 18px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(66px, 8.4vw, 126px); line-height: .78; letter-spacing: -.07em; }
.title-card h1 span { color: var(--rust); font-style: italic; font-size: .72em; letter-spacing: -.045em; }
.tagline { max-width: 620px; font-size: 19px; line-height: 1.55; color: var(--ink-soft); }

.difficulty-grid { display: grid; gap: 10px; margin: 34px 0 24px; max-width: 650px; }
.difficulty-card { display: grid; grid-template-columns: 150px 1fr; gap: 18px; align-items: center; width: 100%; border: 1px solid rgba(16,42,43,.14); border-radius: 14px; padding: 15px 18px; text-align: left; background: rgba(255,250,240,.54); color: var(--ink); transition: .18s ease; }
.difficulty-card:hover, .difficulty-card.selected { transform: translateX(6px); border-color: var(--rust); background: rgba(255,250,240,.94); box-shadow: 0 8px 25px rgba(16,42,43,.08); }
.difficulty-card strong { font-size: 14px; }
.difficulty-card span { color: var(--ink-soft); font-size: 13px; line-height: 1.35; }
.title-actions { display: flex; gap: 16px; align-items: center; }
.primary-button, .secondary-button { border: 0; border-radius: 999px; padding: 14px 22px; font-weight: 900; }
.primary-button { color: #fff; background: var(--rust); box-shadow: 0 8px 22px rgba(163,76,52,.24); }
.primary-button:hover { filter: brightness(1.08); transform: translateY(-1px); }
.secondary-button { color: var(--ink); background: #e9dfc7; }
.text-button { border: 0; background: none; color: var(--ink-soft); text-decoration: underline; }
.save-notice { font-size: 12px; color: var(--green); font-weight: 700; }

.title-art { position: relative; min-height: 100vh; overflow: hidden; }
.sun-disc { position: absolute; width: 54vw; aspect-ratio: 1; border-radius: 50%; background: var(--gold-bright); right: -23vw; top: -15vw; opacity: .8; box-shadow: 0 0 0 80px rgba(255,255,255,.08); }
.chapel-silhouette { position: absolute; left: 8%; right: 4%; bottom: 0; height: 72%; background: linear-gradient(90deg, #2e5148, #173a39); clip-path: polygon(0 100%,0 24%,4% 24%,4% 4%,9% 4%,9% 24%,18% 24%,18% 13%,22% 13%,22% 24%,75% 24%,75% 14%,79% 14%,79% 24%,88% 24%,88% 4%,93% 4%,93% 24%,100% 24%,100% 100%); filter: drop-shadow(-28px 20px 0 rgba(255,255,255,.12)); }
.chapel-silhouette::before { content:""; position:absolute; left:21%; right:21%; top:31%; bottom:0; background:#bdab81; clip-path: polygon(0 100%, 0 13%, 6% 13%, 6% 2%, 12% 2%, 12% 13%, 88% 13%, 88% 2%, 94% 2%, 94% 13%, 100% 13%, 100% 100%); opacity:.9; }
.chapel-silhouette::after { content:""; position:absolute; left:35%; right:35%; top:39%; height:46%; border:10px solid #173a39; border-bottom:0; border-radius: 50% 50% 0 0; box-shadow: inset 0 0 0 10px rgba(255,255,255,.09); }
.camera-mark { position:absolute; right:15%; top:43%; width:92px; height:92px; display:grid; place-items:center; border:4px solid var(--cream); border-radius:50%; color:var(--cream); font-size:48px; transform:rotate(-8deg); box-shadow:0 0 0 14px rgba(255,255,255,.13); }

.game-screen { background: #122f30; }
.hud { height: 82px; display:flex; align-items:center; justify-content:space-between; gap:20px; padding: 0 26px; color:#fff; background:#102a2b; border-bottom:1px solid rgba(255,255,255,.1); }
.brand-lockup { display:flex; align-items:center; gap:12px; min-width:230px; }
.brand-mark { display:grid; place-items:center; width:38px; height:38px; border:2px solid var(--gold-bright); border-radius:10px; color:var(--gold-bright); }
.brand-lockup div { display:grid; }
.brand-lockup small { color:#a9c0bc; margin-top:2px; }
.hud-stats { display:flex; gap:8px; }
.stat { min-width:88px; padding:9px 14px; border:1px solid rgba(255,255,255,.1); border-radius:11px; background:rgba(255,255,255,.04); }
.stat span { display:block; color:#9cb4b0; font-size:10px; letter-spacing:.12em; text-transform:uppercase; }
.stat strong { display:block; margin-top:2px; color:#fff8e9; font-size:17px; }
.hud-actions { display:flex; gap:8px; }
.icon-button { border:1px solid rgba(255,255,255,.13); border-radius:9px; padding:9px 12px; background:rgba(255,255,255,.06); color:inherit; font-size:12px; font-weight:800; }
.icon-button:hover { background:rgba(255,255,255,.12); }
.game-stage-wrap { position:relative; width:min(100vw, 1500px); margin:auto; aspect-ratio:16/9; max-height:calc(100vh - 82px); overflow:hidden; background:#8bb2a5; }
#gameCanvas { display:block; width:100%; height:100%; touch-action:none; }
.route-card, .controls-card { position:absolute; padding:14px 16px; border:1px solid rgba(255,255,255,.45); border-radius:12px; background:rgba(255,250,240,.9); box-shadow:0 12px 30px rgba(16,42,43,.15); backdrop-filter:blur(7px); }
.route-card { top:20px; left:20px; width:270px; }
.route-label { font-size:10px; font-weight:900; letter-spacing:.12em; text-transform:uppercase; color:var(--rust); }
.route-card strong { display:block; margin-top:5px; }
.route-card p { margin:5px 0 0; font-size:12px; line-height:1.45; color:var(--ink-soft); }
.controls-card { right:20px; bottom:20px; display:flex; gap:13px; font-size:11px; color:var(--ink-soft); }
kbd { border:1px solid rgba(16,42,43,.2); border-bottom-width:2px; border-radius:5px; padding:2px 6px; background:#fff; color:var(--ink); font-weight:900; }
.interaction-prompt { position:absolute; left:50%; bottom:40px; transform:translateX(-50%); display:flex; align-items:center; gap:10px; padding:11px 16px; border-radius:999px; background:#102a2b; color:#fff; box-shadow:var(--shadow); font-weight:800; }

.modal-layer { position:fixed; inset:0; z-index:30; display:grid; place-items:center; padding:20px; background:rgba(7,25,26,.74); backdrop-filter:blur(8px); }
.modal-card { width:min(920px, 96vw); max-height:94vh; overflow:auto; border:1px solid rgba(255,255,255,.5); border-radius:22px; padding:30px; background:var(--paper); box-shadow:var(--shadow); }
.intro-card { display:grid; grid-template-columns:90px 1fr; gap:24px; max-width:760px; }
.intro-card h2, .quiz-card h2, .completion-card h2, .portfolio-card h2, .results-card h2 { margin:8px 0 12px; font-family:Georgia,serif; font-size:34px; }
.intro-card p { color:var(--ink-soft); line-height:1.55; }
.cat-badge { width:74px; height:74px; display:grid; place-items:center; border-radius:28px 28px 22px 22px; background:var(--ink); color:var(--gold-bright); font-family:Georgia,serif; font-size:38px; position:relative; }
.cat-badge::before, .cat-badge::after { content:""; position:absolute; top:-10px; width:26px; height:26px; background:var(--ink); transform:rotate(45deg); }
.cat-badge::before { left:4px; } .cat-badge::after { right:4px; }
.brief-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; margin:24px 0; }
.brief-grid div { padding:14px; border-radius:12px; background:#ece2cb; }
.brief-grid strong { display:block; color:var(--rust); font-size:22px; }
.brief-grid span { display:block; margin-top:4px; font-size:12px; line-height:1.35; }

.photo-layer { padding:12px; background:rgba(6,20,21,.94); }
.photo-shell { width:min(1180px, 98vw); max-height:98vh; display:grid; grid-template-rows:auto 1fr auto; overflow:hidden; border:1px solid rgba(255,255,255,.14); border-radius:18px; background:#0e2728; color:#fff; box-shadow:0 28px 100px rgba(0,0,0,.45); }
.photo-header { display:flex; align-items:flex-start; justify-content:space-between; gap:20px; padding:18px 22px; }
.photo-header h2 { margin:4px 0 3px; font-family:Georgia,serif; font-size:26px; }
.photo-header p { margin:0; color:#aec4c1; font-size:13px; }
.photo-header-right { display:flex; gap:18px; align-items:center; }
.photo-timer { text-align:right; }
.photo-timer span { display:block; color:#8ea8a4; font-size:10px; text-transform:uppercase; letter-spacing:.12em; }
.photo-timer strong { font-variant-numeric:tabular-nums; }
.photo-stage { position:relative; background:#050e0f; }
#photoCanvas { display:block; width:100%; height:auto; max-height:calc(98vh - 190px); margin:auto; touch-action:none; }
.photo-instruction { position:absolute; left:50%; bottom:14px; transform:translateX(-50%); padding:8px 13px; border-radius:999px; background:rgba(7,24,25,.75); color:#e9f0ed; font-size:11px; white-space:nowrap; }
.photo-controls { min-height:86px; display:grid; grid-template-columns:1fr auto 110px; align-items:center; gap:22px; padding:14px 24px; }
.zoom-control { display:grid; grid-template-columns:auto 60px 1fr; gap:12px; align-items:center; max-width:430px; }
.zoom-control span { color:#92aaa6; font-size:11px; text-transform:uppercase; letter-spacing:.1em; }
.zoom-control input { accent-color:var(--gold-bright); }
.camera-settings { display:flex; gap:8px; }
.camera-settings span { padding:7px 10px; border:1px solid rgba(255,255,255,.1); border-radius:6px; color:#c9d5d2; font-family:ui-monospace,monospace; font-size:11px; }
.shutter-button { justify-self:end; width:66px; height:66px; display:grid; place-items:center; border:5px solid #d5dedb; border-radius:50%; background:transparent; }
.shutter-button span { width:46px; height:46px; border-radius:50%; background:#f1f0e8; transition:.1s; }
.shutter-button:active span { transform:scale(.84); background:var(--gold-bright); }

.results-card { display:grid; grid-template-columns:minmax(280px,1.15fr) minmax(330px,.85fr); gap:30px; }
.result-photo-wrap { min-height:410px; display:grid; place-items:center; padding:16px; border-radius:16px; background:#172d2d; }
.result-photo-wrap img { display:block; max-width:100%; max-height:520px; border:10px solid #f8f1df; box-shadow:0 14px 30px rgba(0,0,0,.28); transform:rotate(-1.2deg); }
.score-ring { display:flex; align-items:baseline; gap:3px; }
.score-ring strong { font-size:58px; line-height:1; color:var(--rust); }
.score-ring span { color:#7a817c; }
.medal-label { display:inline-block; margin:6px 0 16px; padding:5px 10px; border-radius:999px; background:#e8dec6; font-size:11px; font-weight:900; text-transform:uppercase; letter-spacing:.1em; }
.score-breakdown { display:grid; gap:7px; }
.score-breakdown div { display:flex; justify-content:space-between; padding:8px 0; border-bottom:1px solid #e2d9c5; }
.score-breakdown span { color:var(--ink-soft); }
.result-feedback { min-height:46px; font-size:13px; line-height:1.5; color:var(--ink-soft); }
.result-actions { display:flex; gap:10px; margin-top:18px; }

.quiz-card { max-width:720px; text-align:center; }
.quiz-location { color:var(--green); font-size:11px; font-weight:900; letter-spacing:.16em; }
.quiz-options { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin:24px 0; }
.quiz-option { border:1px solid #d8cfba; border-radius:12px; padding:15px; background:#fffdf8; color:var(--ink); font-weight:800; }
.quiz-option:hover { border-color:var(--rust); }
.quiz-option.correct { color:#fff; background:var(--green); border-color:var(--green); }
.quiz-option.wrong { color:#fff; background:var(--danger); border-color:var(--danger); }
.quiz-feedback { padding:14px; border-radius:12px; background:#eee4cf; color:var(--ink-soft); line-height:1.5; }

.portfolio-card { width:min(1100px,96vw); }
.portfolio-header { display:flex; align-items:start; justify-content:space-between; }
.portfolio-header .icon-button { color:var(--ink); border-color:#d5cbb5; background:#eee5d2; }
.portfolio-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(210px,1fr)); gap:16px; margin-top:18px; }
.portfolio-empty { grid-column:1/-1; padding:60px 20px; text-align:center; border:2px dashed #d8cfba; border-radius:16px; color:var(--ink-soft); }
.portfolio-item { overflow:hidden; border-radius:14px; background:#152f30; color:#fff; box-shadow:0 8px 24px rgba(16,42,43,.14); }
.portfolio-item img { width:100%; aspect-ratio:3/2; object-fit:cover; display:block; }
.portfolio-meta { padding:12px; }
.portfolio-meta strong { display:block; }
.portfolio-meta span { display:block; margin-top:4px; color:#abc0bd; font-size:12px; }

.completion-card { max-width:680px; text-align:center; }
.completion-camera { width:90px; height:90px; display:grid; place-items:center; margin:0 auto 18px; border-radius:50%; background:var(--ink); color:var(--gold-bright); font-size:42px; }
.completion-card p { color:var(--ink-soft); }
.completion-rank { margin:22px auto; width:180px; padding:18px; border-radius:18px; background:#ece2cb; }
.completion-rank span { display:block; font-size:10px; text-transform:uppercase; letter-spacing:.12em; }
.completion-rank strong { display:block; color:var(--rust); font-family:Georgia,serif; font-size:72px; line-height:1; }
.completion-actions { display:flex; justify-content:center; gap:10px; }

@media (max-width: 900px) {
  .title-screen { grid-template-columns:1fr; }
  .title-art { position:absolute; inset:0; opacity:.22; }
  .title-card { padding:40px 24px; }
  .difficulty-card { grid-template-columns:1fr; gap:4px; }
  .hud { height:auto; min-height:92px; flex-wrap:wrap; padding:12px; }
  .brand-lockup { min-width:0; }
  .hud-stats { order:3; width:100%; justify-content:center; }
  .stat { min-width:72px; padding:7px 10px; }
  .game-stage-wrap { max-height:none; }
  .controls-card { display:none; }
  .route-card { width:230px; }
  .results-card { grid-template-columns:1fr; max-height:96vh; }
  .result-photo-wrap { min-height:240px; }
  .quiz-options { grid-template-columns:1fr; }
  .photo-controls { grid-template-columns:1fr auto; }
  .camera-settings { display:none; }
  .intro-card { grid-template-columns:1fr; }
  .brief-grid { grid-template-columns:1fr; }
}

@media (max-width: 560px) {
  .title-card h1 { font-size:64px; }
  .title-actions { align-items:flex-start; flex-direction:column; }
  .hud-actions .icon-button:nth-child(2) { display:none; }
  .hud-stats { gap:4px; }
  .stat { min-width:62px; }
  .stat span { font-size:8px; }
  .stat strong { font-size:14px; }
  .route-card { top:10px; left:10px; width:205px; padding:10px 12px; }
  .photo-header { padding:12px; }
  .photo-header p { display:none; }
  .photo-header h2 { font-size:20px; }
  .photo-controls { padding:10px 14px; }
  .zoom-control { grid-template-columns:auto 50px 1fr; }
  .shutter-button { width:58px; height:58px; }
  .shutter-button span { width:40px; height:40px; }
  .modal-card { padding:20px; }
}
