@import url('../public/fonts/fonts.local.css');

:root {
  --paper: #fbf6ee;
  --paper-2: #f3ebdf;
  --ink: #3b2f28;
  --ink-soft: #6d5d52;
  --accent: #c8642a;        /* seasonal accent, updated by JS */
  --accent-2: #7a8f5a;
  --card: rgba(251, 246, 238, 0.86);
  --card-strong: rgba(251, 246, 238, 0.96);
  --shadow: 0 10px 30px rgba(40, 25, 15, 0.18), 0 2px 6px rgba(40, 25, 15, 0.12);
  --radius: 18px;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Nunito', ui-rounded, system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0d0b0a; color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
canvas#game { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; outline: none; }
#ui { position: fixed; inset: 0; pointer-events: none; user-select: none; }
#ui .interactive, #ui button, #ui input, #ui select, #ui .panel { pointer-events: auto; }
#ui.hidden-hud .hud { opacity: 0; }
.hud { transition: opacity .4s ease; }

button { font-family: var(--sans); cursor: pointer; }

/* ---------- HUD ---------- */
.hud-clock {
  position: absolute; left: 22px; top: 20px; padding: 14px 18px 13px; min-width: 210px;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); backdrop-filter: blur(10px);
}
.hud-clock .loc { font-family: var(--serif); font-weight: 600; font-size: 17px; letter-spacing: .2px; }
.hud-clock .region { font-size: 12px; color: var(--ink-soft); margin-top: 1px; text-transform: uppercase; letter-spacing: 1.2px; font-weight: 700; }
.hud-clock .row { display: flex; align-items: baseline; gap: 10px; margin-top: 8px; }
.hud-clock .time { font-family: var(--serif); font-size: 30px; font-weight: 600; line-height: 1; }
.hud-clock .date { font-size: 13px; color: var(--ink-soft); font-weight: 600; }
.hud-clock .wx { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 14px; font-weight: 700; color: var(--ink-soft); }
.hud-clock .wx .icon { font-size: 20px; }
.hud-clock .season-chip { display: inline-block; margin-left: auto; padding: 2px 10px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 800; letter-spacing: .4px; }

.hud-buttons { position: absolute; right: 20px; top: 20px; display: flex; gap: 10px; }
.hud-btn {
  pointer-events: auto; width: 50px; height: 50px; border-radius: 16px; border: none; background: var(--card);
  box-shadow: var(--shadow); font-size: 22px; display: grid; place-items: center; position: relative; backdrop-filter: blur(10px);
  transition: transform .15s ease, background .15s ease;
}
.hud-btn:hover { transform: translateY(-2px); background: var(--card-strong); }
.hud-btn .key { position: absolute; bottom: 3px; right: 6px; font-size: 9px; font-weight: 800; color: var(--ink-soft); }

.prompt {
  position: absolute; left: 50%; bottom: 13%; transform: translateX(-50%) translateY(10px); opacity: 0;
  display: flex; align-items: center; gap: 10px; padding: 10px 18px 10px 10px; border-radius: 999px;
  background: var(--card-strong); box-shadow: var(--shadow); font-weight: 700; font-size: 16px; transition: all .18s ease;
}
.prompt.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; cursor: pointer; }
.keycap { display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 8px; border-radius: 9px; background: var(--ink); color: var(--paper); font-weight: 800; font-size: 14px; box-shadow: inset 0 -3px 0 rgba(0,0,0,.35); }

.toasts { position: absolute; top: 22px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.toast {
  min-width: 260px; max-width: 460px; padding: 12px 20px; border-radius: 16px; background: var(--card-strong); box-shadow: var(--shadow);
  text-align: center; animation: toastIn .45s cubic-bezier(.2,1.4,.4,1) both;
}
.toast.out { animation: toastOut .4s ease both; }
.toast .t { font-family: var(--serif); font-weight: 600; font-size: 18px; }
.toast .s { font-size: 13px; color: var(--ink-soft); margin-top: 2px; font-weight: 600; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-16px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px); } }

.tracker { position: absolute; right: 22px; top: 92px; width: 270px; padding: 14px 16px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); backdrop-filter: blur(10px); }
.tracker h4 { margin: 0 0 8px; font-family: var(--serif); font-weight: 600; font-size: 15px; display: flex; justify-content: space-between; }
.tracker h4 small { font-family: var(--sans); font-size: 11px; color: var(--ink-soft); font-weight: 700; }
.tracker .q { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; font-weight: 600; padding: 4px 0; color: var(--ink); }
.tracker .q .box { flex: 0 0 16px; height: 16px; border-radius: 5px; border: 2px solid var(--ink-soft); margin-top: 1px; }
.tracker .q.done { color: var(--ink-soft); text-decoration: line-through; }
.tracker .q.done .box { background: var(--accent-2); border-color: var(--accent-2); }

.hint { position: absolute; left: 22px; bottom: 20px; padding: 10px 14px; border-radius: 14px; background: var(--card); box-shadow: var(--shadow); font-size: 12.5px; font-weight: 700; color: var(--ink-soft); line-height: 1.7; }
.hint b { color: var(--ink); }

.pet-bar { position: absolute; left: 22px; bottom: 20px; display: flex; gap: 8px; }

.crosshair { position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: rgba(255,255,255,.75); box-shadow: 0 0 4px rgba(0,0,0,.5); display: none; }
.first-person .crosshair { display: block; opacity: .45; transition: transform .15s ease, opacity .15s ease; }
.first-person.has-target .crosshair { opacity: .95; transform: scale(1.6); box-shadow: 0 0 0 2px rgba(255,255,255,.35), 0 0 6px rgba(0,0,0,.5); }
.look-hint { position: absolute; left: 50%; top: 58%; transform: translateX(-50%); padding: 10px 18px; border-radius: 999px; background: rgba(28,20,15,.62); color: #fff; font-weight: 800; font-size: 14px; backdrop-filter: blur(6px); opacity: 0; transition: opacity .3s ease; pointer-events: none; }
.need-click .look-hint { opacity: 1; }
.need-click .crosshair { display: none; }
.pose-hint { position: absolute; left: 50%; bottom: 150px; transform: translateX(-50%); padding: 6px 12px; border-radius: 12px; background: rgba(28,20,15,.5); color: #fff; font-weight: 700; font-size: 12.5px; opacity: 0; transition: opacity .4s ease; pointer-events: none; display: flex; gap: 8px; align-items: center; }
.pose-hint .keycap { height: 22px; min-width: 22px; font-size: 11px; background: #fff; color: #2a1e16; }
.posed .pose-hint { opacity: .9; }
.markers { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.marker { position: absolute; left: 0; top: 0; width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,.9); box-shadow: 0 0 0 3px rgba(255,255,255,.22), 0 1px 6px rgba(0,0,0,.45); display: none; place-items: center; font-size: 0; will-change: transform; transition: width .2s ease, height .2s ease, font-size .2s ease; }
.marker.near { width: 30px; height: 30px; font-size: 16px; background: rgba(255,250,242,.92); box-shadow: 0 2px 10px rgba(0,0,0,.35); }
#ui.build-mode .markers, #ui.hidden-hud .markers, #ui.hidden-hud .look-hint, #ui.hidden-hud .pose-hint { display: none; }

/* ---------- overlays ---------- */
.fade { position: absolute; inset: 0; background: #0b0807; opacity: 0; transition: opacity 1s ease; pointer-events: none; }
.loading { position: absolute; inset: 0; display: none; background: radial-gradient(ellipse at center, #3a2a20 0%, #17100c 75%); color: var(--paper); pointer-events: auto; overflow: hidden; }
.loading.show { display: block; }
.loading .art { position: absolute; inset: -3%; background-size: cover; background-position: center; opacity: 0; transition: opacity .7s ease; animation: loadZoom 26s ease-out both; }
.loading .art.on { opacity: 1; }
@keyframes loadZoom { from { transform: scale(1); } to { transform: scale(1.07); } }
.loading .shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(18,12,9,.28) 0%, rgba(18,12,9,0) 26%, rgba(18,12,9,0) 46%, rgba(18,12,9,.82) 100%); }
.loading .lower { position: absolute; left: 6vw; right: 6vw; bottom: 7vh; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.loading .kicker { font-weight: 800; letter-spacing: .16em; text-transform: uppercase; font-size: 13px; opacity: .88; text-shadow: 0 2px 12px rgba(0,0,0,.6); min-height: 16px; }
.loading .title { font-family: var(--serif); font-size: clamp(40px, 6vw, 78px); font-weight: 600; line-height: 1; letter-spacing: .3px; text-shadow: 0 4px 30px rgba(0,0,0,.6); }
.loading .sub { font-size: 15px; opacity: .92; font-weight: 700; text-shadow: 0 2px 10px rgba(0,0,0,.6); }
.loading .bar { width: min(440px, 62vw); height: 5px; border-radius: 5px; background: rgba(255,255,255,.22); overflow: hidden; }
.loading .bar i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, #f0b57a, #e07a3c); transition: width .25s ease; }

/* ---------- panels / menus ---------- */
.screen { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(20, 12, 8, 0.35); backdrop-filter: blur(6px); pointer-events: auto; }
.screen.show { display: flex; animation: fadeIn .25s ease both; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.panel {
  background: var(--paper); border-radius: 26px; box-shadow: 0 30px 80px rgba(20,10,5,.4); padding: 28px 32px; max-height: 88vh; overflow: auto;
  border: 1px solid rgba(255,255,255,.6);
}
.panel h2 { font-family: var(--serif); font-weight: 600; font-size: 30px; margin: 0 0 4px; }
.panel h3 { font-family: var(--serif); font-weight: 600; font-size: 19px; margin: 18px 0 8px; }
.panel .sub { color: var(--ink-soft); font-weight: 600; font-size: 14px; margin-bottom: 14px; }
.btn {
  border: none; border-radius: 14px; padding: 12px 20px; font-weight: 800; font-size: 15px; background: var(--paper-2); color: var(--ink);
  box-shadow: 0 2px 0 rgba(0,0,0,.08); transition: transform .12s ease, background .12s ease;
}
.btn:hover { transform: translateY(-1px); background: #ebe0d0; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.menu-list { display: flex; flex-direction: column; gap: 10px; min-width: 280px; }
.menu-list .btn { text-align: left; padding: 14px 18px; font-size: 16px; }
.tabs { display: flex; gap: 6px; margin: 6px 0 14px; flex-wrap: wrap; }
.tab { border: none; padding: 8px 14px; border-radius: 999px; background: var(--paper-2); font-weight: 800; font-size: 13px; color: var(--ink-soft); }
.tab.active { background: var(--ink); color: var(--paper); }
.row { display: flex; align-items: center; gap: 12px; margin: 10px 0; }
.row label { flex: 0 0 170px; font-weight: 700; font-size: 14px; color: var(--ink-soft); }
.row select, .row input[type=range] { flex: 1; }
select, input[type=text] { font-family: var(--sans); font-weight: 700; font-size: 14px; padding: 8px 10px; border-radius: 10px; border: 1px solid #ddd0bf; background: #fff; color: var(--ink); }
input[type=range] { accent-color: var(--accent); }
.close-x { position: absolute; top: 18px; right: 20px; border: none; background: var(--paper-2); width: 38px; height: 38px; border-radius: 12px; font-size: 18px; font-weight: 800; }
.panel { position: relative; }
.kbd-list { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; font-weight: 600; }
.kbd-list .keycap { height: 26px; min-width: 26px; font-size: 12px; }

/* ---------- hearts ---------- */
.heart { position: absolute; font-size: 22px; animation: heartUp 1.4s ease-out forwards; pointer-events: none; }
@keyframes heartUp { from { opacity: 0; transform: translate(-50%, 0) scale(.6); } 20% { opacity: 1; } to { opacity: 0; transform: translate(-50%, -80px) scale(1.2); } }

.minimap { position: absolute; right: 22px; bottom: 22px; width: 160px; height: 160px; border-radius: 50%; box-shadow: var(--shadow); cursor: pointer; }

.season-pop { position: absolute; left: 100%; top: 0; margin-left: 10px; background: var(--card-strong); border-radius: 16px; box-shadow: var(--shadow); padding: 8px; display: flex; flex-direction: column; gap: 4px; animation: fadeIn .15s ease both; }
.season-pop button { border: none; background: transparent; text-align: left; padding: 8px 12px; border-radius: 10px; font-weight: 800; font-size: 14px; color: var(--ink); display: flex; gap: 8px; align-items: center; white-space: nowrap; }
.season-pop button:hover { background: var(--paper-2); }
.season-pop button.on { background: var(--accent); color: #fff; }

.loading .tip { max-width: 640px; text-align: left; font-size: 14px; font-weight: 600; opacity: 1; color: rgba(251,246,238,.9); transition: opacity .25s ease; min-height: 20px; text-shadow: 0 2px 10px rgba(0,0,0,.65); }
