/* ============================================================
   IRONWOOD VALLEY — styles.css
   Diegetic western chrome: paper & brass, slab-serif display,
   monospace HUD accents (telegraph-ticker flavor), soft vignettes.
   ============================================================ */
:root {
  --ink: #2e2416;
  --paper: #d9c49a;
  --paper-dim: #bfa878;
  --brass: #c99a4c;
  --blood: #7c1616;
  --accent-mono: #d8e6cf;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0c0906; }
body {
  font-family: Georgia, 'Times New Roman', serif;
  color: var(--ink);
  user-select: none;
  -webkit-user-select: none;
}
.mono {
  font-family: ui-monospace, Menlo, Consolas, 'Courier New', monospace;
}
canvas { display: block; }
#app canvas { cursor: crosshair; }

#grade-vignette {
  position: fixed; inset: 0; z-index: 20; pointer-events: none;
  background:
    radial-gradient(130% 100% at 50% 42%, transparent 58%, rgba(24,12,4,.34) 100%),
    linear-gradient(rgba(255,196,110,.05), rgba(30,16,6,.10));
  mix-blend-mode: multiply;
}

/* ---------------- TITLE ---------------- */
#title-screen {
  position: fixed; inset: 0; z-index: 60;
  background:
    radial-gradient(120% 90% at 50% 110%, rgba(214,138,54,.32), transparent 60%),
    linear-gradient(#170f07, #241609 55%, #4a2c12);
  display: flex; align-items: center; justify-content: center;
  transition: opacity .8s ease;
}
#title-screen.gone { opacity: 0; pointer-events: none; }
.title-inner { text-align: center; color: #e8d9ae; padding: 24px; max-width: 640px; }
.title-inner .overline { letter-spacing: .35em; text-transform: uppercase; font-size: 11px; color: #b99a63; margin-bottom: 18px; }
.title-inner h1 {
  font-size: clamp(56px, 11vw, 118px); line-height: .92; letter-spacing: .04em;
  color: #ecdcb4;
  text-shadow: 0 3px 0 #6b4416, 0 10px 28px rgba(0,0,0,.65), 0 0 44px rgba(255,168,66,.25);
  font-weight: bold;
}
.title-inner .tag { margin-top: 18px; font-style: italic; color: #cdb684; line-height: 1.5; }
#btn-begin {
  margin-top: 30px;
  font-family: Georgia, serif; font-weight: bold; letter-spacing: .14em;
  font-size: 17px; color: #f4e6bd;
  background: linear-gradient(#8c5722, #6e3f16);
  border: 1px solid #caa15c; border-radius: 3px;
  padding: 14px 38px; cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,220,160,.35);
}
#btn-begin:hover { filter: brightness(1.13); }
.t-controls { margin-top: 34px; display: grid; gap: 6px; font-size: 12.5px; color: #a98f62; }
.t-controls b { color: #e2cd97; font-weight: bold; }
.fineprint { margin-top: 20px; font-size: 12px; font-style: italic; color: #83704d; }

/* ---------------- MOBILE NOTICE ---------------- */
#mobile-note {
  position: fixed; inset: 0; z-index: 70; display: none;
  align-items: flex-end; justify-content: center; pointer-events: none;
  background: rgba(8,6,3,.72); backdrop-filter: blur(6px);
}
#mobile-note.show { display: flex; }
.mn-card {
  pointer-events: auto; margin-bottom: 9vh; max-width: 420px; margin-left: 16px; margin-right: 16px;
  background: var(--paper); border: 2px solid var(--ink); border-radius: 4px;
  padding: 22px 26px; box-shadow: 0 12px 40px rgba(0,0,0,.6);
}
.mn-card h3 { margin-bottom: 10px; letter-spacing: .06em; }
.mn-card p { line-height: 1.45; font-size: 14.5px; }
.mn-card button {
  margin-top: 14px; padding: 9px 18px; border-radius: 3px;
  border: 1.5px solid var(--ink); background: #c7ad7c; cursor: pointer;
  font-family: Georgia, serif; font-weight: bold;
}

/* ---------------- HUD ---------------- */
#ui-root { position: fixed; inset: 0; pointer-events: none; z-index: 30; }
/* overlays opt back INTO interaction explicitly */

#hud { position: absolute; inset: 0; }
.pk-felt { pointer-events: auto; }

#cores {
  position: absolute; left: 22px; bottom: 20px;
  display: flex; flex-direction: column; gap: 8px;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.7));
}
.core { display: grid; grid-template-columns: 64px 130px; align-items: center; gap: 8px; }
.core i { font-style: normal; font-size: 10px; letter-spacing: .22em; color: #f0e2ba; opacity: .85; }
.core b {
  display: block; height: 8px; background: rgba(12,9,6,.55);
  border: 1px solid rgba(238,216,160,.4); border-radius: 4px; overflow: hidden;
}
.core span { display: block; height: 100%; width: 100%; transition: width .25s ease; }
#core-health { background: linear-gradient(90deg, #7c1616, #c2402c); }
#core-stamina { background: linear-gradient(90deg, #6d7a2c, #b9b23e); }
.core.horse span { background: linear-gradient(90deg, #59401f, #a67c3c); }

#status-right { position: absolute; right: 24px; top: 18px; text-align: right; }
#money-label {
  font-size: 21px; color: var(--accent-mono);
  text-shadow: 0 0 9px rgba(190,235,190,.4), 0 2px 4px rgba(0,0,0,.85);
  letter-spacing: .04em;
}
#clock-row { margin-top: 5px; font-size: 13.5px; color: #efe0b8; text-shadow: 0 2px 4px rgba(0,0,0,.8); }
#ammo-label { font-size: 11.5px; color: #cbb887; opacity: .95; }
#weather-note { margin-top: 3px; font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase; color: #bda779; opacity: .8; }

#wanted-tag {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%) scale(.8);
  font-weight: bold; letter-spacing: .3em; font-size: 17px; color: #ff5643;
  border: 2px solid #a02c1e; padding: 5px 20px 5px 24px;
  background: rgba(40,6,4,.55);
  opacity: 0; transition: opacity .3s ease, transform .3s ease;
}
#wanted-tag.on { opacity: 1; transform: translateX(-50%) scale(1); animation: throb 1.6s ease-in-out infinite; }
#wanted-tag[data-bounty]:not([data-bounty=""])::after {
  content: "  · " attr(data-bounty); letter-spacing: .1em; font-size: 13px; color: #ffb199;
}
@keyframes throb { 50% { opacity: .65; } }

#prompt-box {
  position: absolute; left: 50%; bottom: 74px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  background: rgba(20,14,8,.72); border: 1px solid rgba(222,192,130,.4);
  border-radius: 4px; padding: 9px 16px;
  color: #f2e4bc; font-size: 14.5px; opacity: 0; transition: opacity .15s ease;
  white-space: nowrap; max-width: 92vw;
}
#prompt-key {
  min-width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid #d9bd83; border-radius: 3px;
  font-family: ui-monospace, Menlo, monospace; font-weight: bold; font-size: 13px; color: #ffe6ae;
  background: rgba(0,0,0,.35);
}

#toasts {
  position: absolute; right: 22px; top: 96px; display: flex; flex-direction: column; gap: 7px;
  align-items: flex-end; max-width: min(360px, 70vw);
}
.toast {
  background: rgba(22,15,8,.78); color: #ecdcac;
  border-left: 3px solid var(--brass);
  padding: 9px 14px; border-radius: 0 3px 3px 0;
  font-size: 13.5px; line-height: 1.35;
  animation: slidein .25s ease;
  transition: opacity .8s ease;
}
.toast.bad { border-left-color: #b03226; color: #ffc4ae; }
.toast.good { border-left-color: #7aa04a; }
.toast.wanted { border-left-color: #ff5643; color: #ffd7c2; font-weight: bold; }
.toast.fade { opacity: 0; }
@keyframes slidein { from { transform: translateX(24px); opacity: 0; } }

#say-line {
  position: absolute; left: 50%; bottom: 128px; transform: translateX(-50%);
  font-style: italic; font-size: 17px; color: #f4e7c2;
  text-shadow: 0 2px 5px rgba(0,0,0,.9);
  opacity: 0; transition: opacity .35s ease; text-align: center;
  max-width: 76vw;
}
#say-line.on { opacity: 1; }

#banner-box {
  position: absolute; left: 0; right: 0; top: 26%;
  text-align: center; opacity: 0; pointer-events: none;
}
#banner-box.go { animation: bannerSlam 2.6s cubic-bezier(.16,.84,.36,1) forwards; }
#banner-title {
  font-size: clamp(44px, 8vw, 84px); letter-spacing: .34em; padding-left: .34em;
  color: #ff6a52; text-shadow: 0 0 30px rgba(255,60,30,.55), 0 4px 10px rgba(0,0,0,.7);
}
#banner-sub { margin-top: 6px; font-style: italic; color: #f2d7b0; font-size: 19px; text-shadow: 0 2px 6px rgba(0,0,0,.8); }
@keyframes bannerSlam {
  0% { opacity: 0; transform: scale(1.25); } 8% { opacity: 1; transform: scale(1); }
  80% { opacity: 1; } 100% { opacity: 0; }
}

#muzzle-flash {
  position: absolute; left: 58%; top: 46%; width: 130px; height: 130px;
  background: radial-gradient(circle, rgba(255,230,150,.95), rgba(255,150,40,.35) 42%, transparent 68%);
  border-radius: 50%; opacity: 0; mix-blend-mode: screen;
}
#muzzle-flash.pop { animation: flashPop .14s ease-out; }
@keyframes flashPop { from { opacity: 1; transform: scale(.7); } to { opacity: 0; transform: scale(1.5); } }

#damage-vignette { position: absolute; inset: 0; opacity: 0; background: radial-gradient(circle at 50% 50%, transparent 55%, rgba(140,10,5,.55)); }
#damage-vignette.hit { animation: dmgPulse .7s ease-out; }
@keyframes dmgPulse { from { opacity: 1; } to { opacity: 0; } }

#reticle {
  position: absolute; left: 50%; top: 48%; width: 14px; height: 14px;
  transform: translate(-50%, -50%) rotate(45deg);
  border: 1.5px solid rgba(245,225,180,.85);
  box-shadow: 0 0 4px rgba(0,0,0,.8);
  opacity: 0; transition: opacity .12s ease;
}
#reticle::after { content: ''; position: absolute; inset: 4.5px; background: rgba(245,225,180,.9); }
#reticle.on { opacity: 1; }

#death-overlay {
  position: fixed; inset: 0; z-index: 65; display: none;
  background: radial-gradient(circle, rgba(60,4,2,.75), rgba(10,2,1,.95));
}
#death-overlay.on { display: block; animation: deathIn 1.5s ease forwards; }
.death-card { position: absolute; left: 50%; top: 42%; transform: translate(-50%,-50%); text-align: center; color: #e9c6a8; }
.death-card h2 { letter-spacing: .3em; font-size: 34px; }
.death-card p { margin-top: 12px; font-style: italic; color: #c69c7c; }
@keyframes deathIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------------- MODALS ---------------- */
.modal {
  position: fixed; inset: 0; z-index: 50; pointer-events: auto;
  display: flex; align-items: center; justify-content: center;
  background: rgba(9,6,3,.62); backdrop-filter: blur(3px);
}
.modal.dimless { background: rgba(9,6,3,.78); }
.paper {
  width: min(720px, 94vw); max-height: 86vh; overflow-y: auto;
  background:
    radial-gradient(140% 100% at 20% 0%, rgba(255,244,214,.5), transparent 55%),
    linear-gradient(var(--paper), #cdb47f);
  border: 2px solid #33261a; outline: 6px double #33261a00;
  box-shadow: 0 18px 60px rgba(0,0,0,.7), inset 0 0 60px rgba(120,86,44,.3);
  border-radius: 3px; padding: 30px 36px;
}
.paper-text { white-space: normal; font-size: 17.5px; line-height: 1.55; }
.choices { margin-top: 22px; display: flex; flex-direction: column; gap: 9px; }
.chbtn {
  text-align: left; font-family: Georgia, serif; font-size: 15.5px;
  background: rgba(51,38,26,.08); color: var(--ink);
  border: 1.5px solid #6b563a; border-radius: 2px; padding: 11px 15px; cursor: pointer;
  transition: background .15s ease, transform .05s ease;
}
.chbtn:hover:not(:disabled) { background: rgba(51,38,26,.2); }
.chbtn:active:not(:disabled) { transform: translateY(1px); }
.chbtn:disabled { opacity: .42; cursor: default; }
.chbtn.wide { text-align: center; margin-top: 18px; }

.shop h3 { letter-spacing: .18em; font-size: 21px; }
.shop .sub { font-style: italic; margin-top: 3px; color: #6b5334; }
.shop-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; margin-top: 16px; }
.shop-cols h4 { letter-spacing: .22em; font-size: 12px; border-bottom: 1.5px solid #6b563a; padding-bottom: 5px; margin-bottom: 10px; }
.shop-cols .chbtn { width: 100%; font-size: 14px; }
@media (max-width: 700px) { .shop-cols { grid-template-columns: 1fr; } }

/* pause menu frame */
.menu-frame {
  width: min(980px, 96vw); height: min(680px, 90vh);
  display: grid; grid-template-columns: 200px 1fr;
  background: rgba(24,17,9,.92);
  border: 1px solid rgba(215,183,120,.4); border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,.75);
}
.menu-tabs { display: flex; flex-direction: column; padding: 18px 14px; gap: 6px; border-right: 1px solid rgba(215,183,120,.25); }
.menu-tabs button {
  font-family: Georgia, serif; font-size: 15.5px; text-align: left;
  color: #d9c69a; background: transparent; border: 1px solid transparent;
  padding: 11px 14px; border-radius: 3px; cursor: pointer; letter-spacing: .06em;
}
.menu-tabs button:hover { background: rgba(217,198,154,.09); }
.menu-tabs button.sel { border-color: rgba(217,198,154,.5); background: rgba(217,198,154,.12); color: #ffe9b8; }
.menu-tabs button.resume { margin-top: auto; border-color: rgba(217,198,154,.4); text-align: center; }
.menu-tabs .badge { color: #ffb75e; font-style: normal; }
.menu-body { position: relative; overflow-y: auto; display: flex; flex-direction: column; align-items: stretch; padding: 26px 32px; background: radial-gradient(120% 120% at 30% 10%, #23201524, transparent); }
.menu-body > * { flex: 0 0 auto; }
#map-canvas { margin: auto; max-width: 100%; max-height: 100%; box-shadow: 0 14px 44px rgba(0,0,0,.65); border: 1px solid rgba(0,0,0,.5); }

.jhead { color: #ecdfb6; letter-spacing: .24em; font-size: 19px; margin-bottom: 14px; }
.ledger { color: #c3ab7c; font-size: 12.5px; margin-bottom: 16px; letter-spacing: .03em; }
.journal-list { overflow-y: visible; padding-right: 8px; display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }
.jentry { border-left: 2px solid #8a6d49; padding: 2px 0 2px 14px; }
.jentry p { color: #ead8ae; font-size: 15px; line-height: 1.45; }
.jdate { font-size: 10.5px; color: #98835a; letter-spacing: .18em; }
.empty { color: #98835a; font-style: italic; }
.controls { color: #d9c69a; border-collapse: collapse; font-size: 14px; }
.controls td { padding: 7px 26px 7px 0; border-bottom: 1px dashed rgba(217,198,154,.18); }
.controls td:first-child { color: #ffe6ae; font-weight: bold; white-space: nowrap; }
.hint-line { color: #a98f62; font-size: 13px; font-style: italic; margin-top: 18px; max-width: 520px; line-height: 1.5; }
.system-wrap { max-height: 80vh; overflow-y: auto; padding: 10px; }
.satchel { white-space: normal !important; max-width: 380px; }

/* ---------------- POKER ---------------- */
.pk-felt {
  width: min(860px, 96vw);
  background:
    radial-gradient(120% 130% at 50% -10%, #3f7a48 0%, #2c5d38 52%, #1d4028 100%);
  border: 10px solid #54381d; outline: 2px solid #2c2015;
  border-radius: 26px; padding: 22px 26px 18px;
  color: #f2ead0; box-shadow: 0 26px 80px rgba(0,0,0,.8);
}
.pk-head { text-align: center; letter-spacing: .3em; font-weight: bold; font-size: 15px; }
.pk-head span { display: block; letter-spacing: .1em; font-weight: normal; font-style: italic; opacity: .75; font-size: 12px; margin-top: 3px; }
.pk-pot { text-align: center; font-family: ui-monospace, Menlo, monospace; font-size: 13.5px; color: #ffe6ae; margin: 12px 0 4px; text-shadow: 0 0 8px rgba(255,220,150,.35); }
.pk-row { display: flex; justify-content: center; gap: 26px; margin: 10px 0 16px; flex-wrap: wrap; }
.pk-bot { text-align: center; min-width: 128px; }
.pk-bot span { display: block; font-size: 14px; }
.pk-bot em { font-style: normal; font-family: ui-monospace, Menlo, monospace; font-size: 11.5px; color: #cdb98a; }
.pk-bot.out { opacity: .38; }
.pk-backs { margin-top: 6px; display: flex; gap: 3px; justify-content: center; }
.pk-backs u { width: 22px; height: 31px; background: repeating-linear-gradient(45deg, #6d1f1a, #6d1f1a 3px, #551512 3px, #551512 6px); border: 1px solid #e8ddc0; border-radius: 3px; display: block; }
.pk-me-hand { display: flex; gap: 8px; justify-content: center; min-height: 78px; }
.pcard {
  width: 58px; height: 78px; background: linear-gradient(#fbf5e4, #eee2c4);
  border: 1.5px solid #333; border-radius: 5px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #171310; font-size: 24px; font-weight: bold;
  box-shadow: 0 4px 10px rgba(0,0,0,.4);
  position: relative;
}
.pcard i { font-style: normal; font-size: 19px; margin-top: 2px; }
.pcard.red { color: #b1272a; }
.pcard.pickable { cursor: pointer; transition: transform .12s ease; }
.pcard.pickable:hover { transform: translateY(-6px); }
.pcard.sel { transform: translateY(-14px); outline: 2.5px solid #ffb340; }
.pk-hint { text-align: center; font-style: italic; color: #e3d7ae; min-height: 20px; margin-top: 10px; font-size: 14px; }
.pk-log {
  min-height: 64px; margin-top: 8px; padding: 8px 14px;
  background: rgba(0,0,0,.22); border-radius: 6px;
  font-family: ui-monospace, Menlo, monospace; font-size: 11.5px; color: #cfe4c8;
}
.pk-actions { display: flex; justify-content: center; gap: 12px; margin-top: 12px; min-height: 42px; }
.pk-actions button {
  font-family: Georgia, serif; font-weight: bold; letter-spacing: .12em;
  padding: 10px 26px; border-radius: 3px; cursor: pointer;
  background: linear-gradient(#caa15c, #a87f39); border: 1.5px solid #3a2c17; color: #241a0e;
}
.pk-actions button:hover { filter: brightness(1.1); }

::-webkit-scrollbar { width: 9px; }
::-webkit-scrollbar-thumb { background: #8a6d49; border-radius: 5px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,.2); }
