/* style.css — shared look: mossy stone + aged bronze. All sizes in rem (1rem ≈ 16px on a 390px-wide phone; core.js scales it). */
:root { --font: Georgia, serif; --gold: #ffd27a; --cream: #f6ecd2; --ink: #1b2a12; --moss: #4f7a3a; --bronze: #b7863d; --teal: #123c44; --red: #e0644f; --green: #8fd17e; --blue: #7fb8ff; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b1c1f; user-select: none; -webkit-user-select: none; }
body { font-family: var(--font); color: var(--cream); }
#app { position: fixed; inset: 0; overflow: hidden; }
#three { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#ui, #layer, #toasts { position: absolute; inset: 0; pointer-events: none; }
#ui .screen { position: absolute; inset: 0; pointer-events: none; }
#ui .btn, #ui .icon-btn, #ui .card, #ui .panel, #ui [data-nav], #ui .hit, #ui input { pointer-events: auto; }
#layer > * { pointer-events: auto; }
#toasts { z-index: 30; }
#layer { z-index: 20; }
#fade { position: absolute; inset: 0; background: #071214; opacity: 0; pointer-events: none; transition: opacity .22s; z-index: 50; }
#fade.on { opacity: 1; pointer-events: auto; }

/* outlined display text */
.ol, .btn, .title-text, .hud-num, .banner span, .float, .toast, #subtitle {
  text-shadow: -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink), 2px 2px 0 var(--ink), 0 2px 0 var(--ink), 2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 -2px 0 var(--ink), 0 4px 0 rgba(0,0,0,.45);
}
.title-text { font-weight: 900; font-size: 1.6rem; color: var(--gold); letter-spacing: .03em; }
.sub-text { font-size: .95rem; color: var(--cream); line-height: 1.4; }
.small { font-size: .8rem; opacity: .85; }

/* panel: 9-slice of ui-panel */
.panel {
  border-style: solid; border-width: 1.3rem; border-image: url(../assets/ui-panel.webp) 64 fill / 1.3rem stretch;
  padding: .35rem .5rem; color: var(--cream); position: relative;
  filter: drop-shadow(0 .4rem .6rem rgba(0,0,0,.45));
}
/* buttons: 9-slice of ui-button */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 3rem; min-width: 3rem; padding: 0 .4rem; cursor: pointer;
  border-style: solid; border-width: .7rem 1rem; border-image: url(../assets/ui-button.webp) 26 40 fill / .7rem 1rem stretch;
  background: none; color: var(--cream); font-family: var(--font); font-weight: 700; font-size: 1rem; line-height: 1.1;
  transition: transform .12s cubic-bezier(.3,1.6,.5,1), filter .15s; text-align: center;
}
.btn img { width: 1.6rem; height: 1.6rem; object-fit: contain; }
.btn:active, .icon-btn:active, .card:active { transform: scale(.92); }
.btn.focus, .icon-btn.focus, .card.focus, [data-nav].focus { filter: brightness(1.25) drop-shadow(0 0 .45rem var(--gold)); transform: scale(1.05); }
@media (hover: hover) { .btn:hover, .icon-btn:hover, .card:hover { filter: brightness(1.18) drop-shadow(0 0 .3rem var(--gold)); } }
.btn.primary { color: var(--gold); font-size: 1.15rem; filter: drop-shadow(0 0 .35rem rgba(255,210,122,.55)); }
.btn.disabled, .btn[disabled] { filter: grayscale(.8) brightness(.7); }
.btn.on { filter: brightness(1.3) drop-shadow(0 0 .4rem var(--gold)); color: var(--gold); }
/* small square icon button on a bronze plate (same family as the pause button) */
.icon-btn {
  width: 3rem; height: 3rem; border-radius: .7rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; position: relative;
  background: radial-gradient(circle at 50% 40%, #3f6a3a, #1f3b26 70%); border: .2rem solid var(--bronze);
  box-shadow: inset 0 0 0 .12rem #e0b465, 0 .25rem 0 #3b2a10, 0 .4rem .5rem rgba(0,0,0,.4); transition: transform .12s cubic-bezier(.3,1.6,.5,1), filter .15s;
}
.icon-btn img { width: 78%; height: 78%; object-fit: contain; pointer-events: none; }
.icon-btn .badge { position: absolute; top: -.35rem; right: -.35rem; min-width: 1.2rem; height: 1.2rem; border-radius: .6rem; background: var(--red); color: #fff; font-size: .75rem; display: flex; align-items: center; justify-content: center; font-weight: 700; padding: 0 .2rem; }
/* labelled tile button (icon + caption), e.g. hub navigation */
.tile { display: flex; flex-direction: column; align-items: center; gap: .15rem; font-size: .78rem; font-weight: 700; }
.tile .icon-btn { width: 3.2rem; height: 3.2rem; }

/* HUD */
.hud { position: absolute; display: flex; align-items: center; gap: .4rem; pointer-events: auto; }
.hud-num { font-weight: 900; font-size: 1.1rem; color: var(--cream); }
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .6rem .2rem .25rem; border-radius: 1rem; background: rgba(10,26,22,.72); border: .12rem solid var(--bronze); font-weight: 700; font-size: 1rem; }
.chip img { width: 1.5rem; height: 1.5rem; object-fit: contain; }

/* bars */
.bar { position: relative; height: .9rem; border-radius: .5rem; background: #0b1714; border: .14rem solid var(--bronze); overflow: hidden; }
.bar .fill { position: absolute; inset: 0; width: 100%; background: linear-gradient(#a6e389, #4f9a3d); transform-origin: left; transition: width .35s ease-out; }
.bar.hp-enemy .fill { background: linear-gradient(#ff9b7a, #c4432f); }
.bar.exp .fill { background: linear-gradient(#ffe39a, #c9922e); }
.bar .lbl { position: absolute; inset: 0; font-size: .65rem; font-weight: 700; display: flex; align-items: center; justify-content: center; text-shadow: 0 1px 2px #000; }

/* cards (role cards, items) */
.card { cursor: pointer; border-radius: .8rem; transition: transform .15s cubic-bezier(.3,1.6,.5,1), filter .15s; position: relative; }
.card.selected { filter: brightness(1.2) drop-shadow(0 0 .6rem var(--gold)); transform: translateY(-.3rem) scale(1.04); }
.swatch { width: max(2.75rem, 46px); height: max(2.75rem, 46px); border-radius: 50%; border: .2rem solid var(--bronze); cursor: pointer; box-shadow: 0 .2rem 0 #3b2a10; }
.swatch.selected { outline: .2rem solid var(--gold); outline-offset: .15rem; }

/* overlays (panels opened over a screen) */
#ui.under-panel { visibility: hidden; pointer-events: none; }
.overlay { position: absolute; inset: 0; background: rgba(4,12,12,.62); display: flex; align-items: center; justify-content: center; padding: 3.6rem .6rem 1rem; animation: fadein .18s ease-out; }
.overlay > .panel { width: 100%; max-height: 100%; display: flex; flex-direction: column; animation: pop .28s cubic-bezier(.3,1.5,.5,1); }
.scroll { overflow-y: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.scroll::-webkit-scrollbar { display: none; }
.row { display: flex; align-items: center; gap: .5rem; }
.grid { display: grid; gap: .5rem; }

/* dialog box (story) */
.dialog { position: absolute; left: .6rem; right: .6rem; bottom: 1.2rem; animation: slideup .25s cubic-bezier(.3,1.4,.5,1); }
.dialog .who { color: var(--gold); font-weight: 900; font-size: 1rem; margin-bottom: .2rem; }
.dialog .text { font-size: 1rem; line-height: 1.5; min-height: 3em; }

/* subtitles, toasts, banners, floating numbers */
#subtitle { position: absolute; left: 6%; right: 6%; top: 15%; text-align: center; font-size: 1rem; font-weight: 700; line-height: 1.4; padding: .4rem .7rem; border-radius: .6rem; background: rgba(6,16,16,.62); opacity: 0; transition: opacity .2s; z-index: 40; pointer-events: none; }
#subtitle.on { opacity: 1; }
.toast { position: absolute; left: 50%; top: 22%; transform: translateX(-50%); background: rgba(12,30,26,.9); border: .14rem solid var(--bronze); padding: .45rem .9rem; border-radius: .8rem; font-weight: 700; font-size: .95rem; white-space: nowrap; animation: pop .25s cubic-bezier(.3,1.5,.5,1); transition: opacity .3s, transform .3s; }
.toast.out { opacity: 0; transform: translate(-50%, -1rem); }
.banner { position: absolute; left: 0; right: 0; top: 36%; display: flex; justify-content: center; animation: slam .38s cubic-bezier(.2,1.6,.4,1); transition: opacity .35s; }
.banner span { font-size: 2.2rem; font-weight: 900; color: var(--gold); padding: .3rem 1.4rem; background: linear-gradient(90deg, transparent, rgba(20,44,30,.9) 20%, rgba(20,44,30,.9) 80%, transparent); }
.banner.out { opacity: 0; }
.float { position: absolute; transform: translate(-50%, -50%); font-weight: 900; font-size: 1.5rem; animation: floatup 1.05s ease-out forwards; pointer-events: none; }
.float.dmg { color: #fff1e0; }
.float.crit { color: var(--gold); font-size: 2.1rem; }
.float.heal { color: #a6f08a; }
.float.miss { color: #b9c6c6; font-size: 1.2rem; }
.hidden { display: none !important; }

@keyframes pop { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideup { from { transform: translateY(2rem); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slam { from { transform: scale(2.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes floatup { 0% { transform: translate(-50%, -30%) scale(.6); opacity: 0; } 15% { transform: translate(-50%, -60%) scale(1.15); opacity: 1; } 100% { transform: translate(-50%, -260%) scale(1); opacity: 0; } }
@keyframes pulse { 0%,100% { opacity: .65; transform: scale(1); } 50% { opacity: 1; transform: scale(1.06); } }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-.4rem); } }
