/* brush kanji for the modes (fonts/LEEME.txt) */
@font-face { font-family: 'WofBrush'; src: url('fonts/brush.woff2') format('woff2'); font-display: swap; }

:root {
  --bg: #120e0c;
  --panel: #1b1613;
  --panel-2: #241d19;
  --line: #3a2e27;
  --text: #f3e9df;
  --muted: #b9a89a;
  --accent: #f07a22;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #000; color: var(--text); font: 15px/1.45 system-ui, sans-serif; }

#game { position: fixed; inset: 0; width: 100%; height: 100%; touch-action: none; outline: none; }
.hud { position: fixed; right: 8px; bottom: 8px; background: rgba(27,22,19,.85); border-radius: 8px; padding: 4px 8px; color: var(--muted); font: 12px ui-monospace, monospace; pointer-events: none; }
.hud:empty { display: none; }

#start { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; overflow: auto;
  background: radial-gradient(ellipse at top, rgba(240,122,34,.18), transparent 60%), rgba(10,8,7,.94); }
#start[hidden] { display: none; }
.panel { width: min(440px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
h1 { margin: 0 0 14px; font-size: 26px; }
h1 small { color: var(--accent); font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; margin-left: 6px; }
.field { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 13px; }
.field input { background: #0f0c0a; color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font: inherit; }
.field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.label { margin: 14px 0 6px; color: var(--muted); font-size: 13px; }
.clans { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.clan { display: flex; flex-direction: column; align-items: center; gap: 2px; background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 6px 4px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.clan canvas { width: 64px; height: 64px; image-rendering: pixelated; }
.clan small { font-weight: 400; font-size: 10px; opacity: .7; line-height: 1.1; }
.clan[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
/* colours at creation: a preview, the part being painted and the palette (19 hues x 7 shades) */
.look { display: grid; grid-template-columns: 64px 1fr; gap: 8px 12px; align-items: start; margin-bottom: 10px; }
.look canvas { width: 64px; height: 64px; image-rendering: pixelated; background: var(--panel-2); border-radius: 10px; }
.look-side { display: grid; gap: 6px; justify-items: start; }
.look-side .hint { margin: 0; font-size: 11px; }
.look-parts { display: flex; gap: 4px; flex-wrap: wrap; }
.look-parts button { padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); font: 600 12px system-ui; cursor: pointer; }
.look-parts button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #1a0f08; }
.look-parts button i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; border: 1px solid #0008; }
.swatches { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(19, 1fr); gap: 2px; }
.swatches button { aspect-ratio: 1; padding: 0; border: 1px solid rgba(0,0,0,.5); border-radius: 3px; cursor: pointer; }
.swatches button[aria-pressed="true"] { outline: 2px solid #fff; outline-offset: -1px; }
.primary { width: 100%; margin-top: 16px; background: var(--accent); color: #1a0f08; border: 0; border-radius: 10px; padding: 12px; font: inherit; font-weight: 700; cursor: pointer; }
.primary:disabled { opacity: .5; cursor: default; }
.status { min-height: 1.4em; margin: 10px 0 0; color: #ffb27a; }
.hint { margin: 6px 0 0; color: var(--muted); font-size: 13px; }

/* ---------- In-game HUD ---------- */
#hud[hidden] { display: none; }
.bar { position: relative; height: 16px; background: rgba(0,0,0,.6); border: 1px solid rgba(255,255,255,.18); border-radius: 5px; overflow: hidden; }
.bar i { position: absolute; inset: 0 auto 0 0; width: 100%; transition: width .2s; }
.bar span { position: relative; display: block; text-align: center; font: 600 11px/16px system-ui, sans-serif; text-shadow: 0 1px 2px #000; }
.bar.hp i { background: linear-gradient(#e2483c, #a92318); }
.bar.ck i { background: linear-gradient(#3d8be2, #1f5aa8); }
.bar.ex { height: 5px; border-radius: 3px; }
.bar.ex i { background: #f0c03a; }
.level { color: var(--muted); font-size: 12px; font-weight: 600; text-shadow: 0 1px 2px #000; }

/* The dock: life, chakra, the action bar and the experience in one dark panel at the bottom, like a sealed scroll
   with a kanji at each end (忍 shinobi, 火 fire). Only the buttons take pointer events; the rest lets taps through. */
.dock { position: fixed; left: 50%; transform: translateX(-50%); bottom: max(8px, env(safe-area-inset-bottom)); z-index: 5;
  display: grid; gap: 6px; padding: 8px 40px 6px; border-radius: 14px; pointer-events: none;
  background: linear-gradient(rgba(14,10,8,.95), rgba(4,3,2,.97)); border: 1px solid rgba(240,122,34,.5);
  box-shadow: 0 0 0 1px #000, 0 6px 22px rgba(0,0,0,.65), inset 0 1px 0 rgba(255,255,255,.06); }
.dock::before, .dock::after { position: absolute; top: 50%; transform: translateY(-50%); font: 700 30px/1 serif;
  color: rgba(240,122,34,.28); text-shadow: 0 0 10px rgba(240,122,34,.25); pointer-events: none; }
.dock::before { content: '忍'; left: 8px; }
.dock::after { content: '火'; right: 8px; }
.dock-bars { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.dock-foot { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; }
.dock-foot .level { white-space: nowrap; }
/* the action bar, Tibia style: slots 1 to 0 in a row and the basic attack at the end */
.jutsus { display: flex; align-items: flex-end; justify-content: center; gap: 6px; pointer-events: none; }
.jutsu { position: relative; width: 52px; height: 52px; border-radius: 10px; border: 2px solid rgba(255,255,255,.3);
  background: radial-gradient(circle at 35% 30%, rgba(80,60,50,.95), rgba(25,18,14,.95)); color: var(--text);
  font: 700 11px/1.1 system-ui, sans-serif; display: grid; place-items: center; padding: 3px; pointer-events: auto;
  touch-action: none; user-select: none; -webkit-user-select: none; overflow: hidden; cursor: pointer; }
.jutsu-basic { order: 1; width: 72px; height: 72px; border-radius: 50%; font-size: 13px; }
.jutsu-guard { order: 1; width: 52px; height: 52px; border-color: rgba(108,200,255,.6); }
.jutsu-right { order: 2; width: 56px; height: 56px; border-radius: 50%; font-size: 12px; }
.jutsu-right kbd { left: 50%; transform: translateX(-50%); top: 4px; }
.jutsu-right .cd, .jutsu-right .charge, .jutsu-basic .cd, .jutsu-basic .charge { border-radius: 50%; } /* round buttons, round overlays */
.jutsu-guard .jn { font-size: 22px; }
.jutsu-guard.active, .jutsu-guard.held { border-color: #6cc8ff; box-shadow: 0 0 10px rgba(108,200,255,.7); }
.jutsu .jn { position: relative; text-align: center; text-shadow: 0 1px 2px #000; }
.jutsu[data-kind="item"] .jn { font-size: 22px; }
.jutsu[data-kind="mode"] .jn { font-size: 10px; }
.jutsu .cd { position: absolute; inset: 0; background: conic-gradient(rgba(0,0,0,.72) var(--p, 0%), transparent 0); }
/* a jutsu charging while its button is held: an orange ring that fills; full, the button glows */
.jutsu .charge { position: absolute; inset: 0; background: conic-gradient(rgba(255,170,60,.55) var(--c, 0%), transparent 0); pointer-events: none; }
.jutsu.charged { box-shadow: 0 0 14px rgba(255,170,60,.9); border-color: #ffb14a; }
.jutsu kbd { position: absolute; top: 2px; left: 4px; font: 600 9px system-ui; color: var(--muted); }
.jutsu-basic kbd { left: 50%; transform: translateX(-50%); top: 5px; }
.jutsu .count { position: absolute; right: 3px; bottom: 1px; font: 700 11px system-ui; text-shadow: 0 1px 2px #000, 0 0 2px #000; }
.jutsu.empty { opacity: .35; border-style: dashed; background: rgba(20,16,13,.6); }
.jutsu.used-up { opacity: .45; }
.jutsu.active { border-color: #7ee07e; box-shadow: 0 0 10px rgba(126,224,126,.6); }
.jutsu.aiming { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(240,122,34,.45); overflow: visible; }
.jutsu.held { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(240,122,34,.45); }
.jutsu .knob { position: absolute; left: 50%; top: 50%; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%;
  background: rgba(240,122,34,.85); box-shadow: 0 0 0 2px rgba(255,255,255,.5); opacity: 0; pointer-events: none; }
.jutsu.aiming .knob { opacity: 1; }
.cancel { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(max(8px, env(safe-area-inset-bottom)) + 136px);
  width: 196px; padding: 10px; border-radius: 12px; text-align: center; font-weight: 700; color: #ffd0c8;
  background: rgba(60,10,10,.75); border: 2px dashed rgba(255,120,100,.6); pointer-events: none; }
.cancel.hot { background: rgba(170,30,20,.9); border-style: solid; }
.cancel[hidden] { display: none; }
.jutsu.nochakra { border-color: #3d8be2; opacity: .6; }
@media (hover: none) { .jutsu kbd { display: none; } }

.toast { position: fixed; left: 50%; top: 18%; transform: translateX(-50%); margin: 0; background: rgba(27,22,19,.92);
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; font-weight: 600; pointer-events: none; max-width: 90vw; text-align: center; }
.dead { position: fixed; inset: 0; margin: 0; display: grid; place-items: center; background: rgba(60,0,0,.45);
  font: 700 28px system-ui, sans-serif; color: #ffd0c8; text-shadow: 0 2px 6px #000; pointer-events: none; }
.dead[hidden], .toast[hidden] { display: none; }
#pos { top: max(8px, env(safe-area-inset-top)); bottom: auto; left: 50%; right: auto; transform: translateX(-50%); }

/* ---------- Account and characters ---------- */
.panel[hidden], #characters[hidden] { display: none; }
.hint a { color: var(--accent); }
.char-list { display: grid; gap: 8px; margin-bottom: 14px; }
.char-list:empty { display: none; }
.char { display: flex; align-items: center; gap: 10px; width: 100%; background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 6px 10px; font: inherit; text-align: left; cursor: pointer; }
.char:hover, .char:focus-visible { border-color: var(--accent); outline: none; }
.char canvas { width: 48px; height: 48px; image-rendering: pixelated; }
.char b { display: block; }
.char span { color: var(--muted); font-size: 13px; }
.create { border-top: 1px solid var(--line); padding-top: 4px; }

/* ---------- Equipment ---------- */
.top-buttons { position: fixed; right: max(12px, env(safe-area-inset-right)); top: max(8px, env(safe-area-inset-top)); display: flex; gap: 6px; }
.top-buttons button { width: 46px; height: 46px; border-radius: 12px; border: 1px solid var(--line); background: rgba(27,22,19,.9);
  color: var(--text); font-size: 22px; cursor: pointer; }
/* the return scroll: its wait as a dark sweep and minutes in the corner; blue while it charges */
#recall { position: relative; overflow: hidden; border-color: rgba(108,200,255,.6); }
#recall .cd { position: absolute; inset: 0; background: conic-gradient(rgba(0,0,0,.7) var(--p, 0%), transparent 0); pointer-events: none; }
#recall small { position: absolute; right: 3px; bottom: 1px; font: 700 10px system-ui; text-shadow: 0 1px 2px #000; }
#recall.charging { border-color: #6cc8ff; box-shadow: 0 0 10px rgba(108,200,255,.7); }
/* consumables in the bag: the icon and how many in the stack */
.slot.stack { position: relative; }
.slot .stack-icon { font-size: 22px; line-height: 1; }
img.stack-icon, img.hot-icon { width: 30px; height: 30px; object-fit: contain; image-rendering: pixelated; vertical-align: middle; pointer-events: none; }
img.mini-icon.stack-icon { width: 28px; height: 28px; }
.jutsu[data-kind="item"] .jn img.hot-icon { width: 26px; height: 26px; }
.slot .stack-n { position: absolute; right: 3px; bottom: 1px; font: 700 11px system-ui; color: #fff; text-shadow: 0 1px 2px #000, 0 0 2px #000; }
.slot.moving { outline: 2px dashed var(--accent); outline-offset: -3px; opacity: .6; }
.slot.droppable { border-color: var(--accent); }
.jutsu.droppable { border-color: var(--accent); }
.mini-icon.stack-icon { display: inline-grid; place-items: center; font-size: 20px; }
.secondary { width: 100%; margin-top: 8px; background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px; font: inherit; font-weight: 700; cursor: pointer; }
.secondary[hidden] { display: none; }
.tip { transform: none; pointer-events: none; z-index: 12; }
.tip .hint { margin: 0; font-size: 11px; }
.inv { position: fixed; z-index: 10; right: max(8px, env(safe-area-inset-right)); top: max(8px, env(safe-area-inset-top));
  width: min(360px, calc(100vw - 16px)); max-height: calc(100vh - 16px); overflow: auto; background: rgba(27,22,19,.97);
  border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px 14px; }
.inv[hidden], .item-card[hidden] { display: none; }
.inv header { display: flex; justify-content: space-between; align-items: center; }
.inv h2 { margin: 0; font-size: 18px; }
.inv h3 { margin: 12px 0 6px; font-size: 14px; color: var(--muted); }
.x { background: none; border: 0; color: var(--muted); font-size: 26px; line-height: 1; cursor: pointer; }
/* like Tibia's: each piece where it is worn (pendant at the neck, weapon in hand), over a faint figure */
.equip { display: grid; grid-template-columns: repeat(3, 56px); grid-template-rows: repeat(4, 56px); gap: 6px;
  grid-template-areas: "accessory head ." "weapon body ." ". legs ." ". feet .";
  background: radial-gradient(ellipse 26px 24px at 50% 10%, rgba(255,255,255,.07) 98%, transparent),
    radial-gradient(ellipse 40px 58px at 50% 38%, rgba(255,255,255,.06) 98%, transparent),
    radial-gradient(ellipse 30px 64px at 50% 74%, rgba(255,255,255,.05) 98%, transparent); }
.equip .slot-head { grid-area: head; } .equip .slot-body { grid-area: body; } .equip .slot-legs { grid-area: legs; }
.equip .slot-feet { grid-area: feet; } .equip .slot-weapon { grid-area: weapon; } .equip .slot-accessory { grid-area: accessory; }
.bag { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; }
.slot { position: relative; aspect-ratio: 1; display: grid; place-items: center; background: #0f0c0a; border: 2px solid #3a2e27;
  border-radius: 8px; cursor: pointer; padding: 0; }
.slot img { width: 80%; height: 80%; object-fit: contain; image-rendering: pixelated; }
.slot .slot-name { position: absolute; bottom: 2px; left: 0; right: 0; text-align: center; font-size: 10px; color: var(--muted); pointer-events: none; }
.slot.r0 { border-color: #8d877f; } .slot.r1 { border-color: #4fd16a; } .slot.r2 { border-color: #b874ff; box-shadow: 0 0 8px rgba(184,116,255,.45); }
.slot.r3 { border-color: #ff9a2e; box-shadow: 0 0 10px rgba(255,154,46,.6); }
.slot.unusable img { opacity: .45; }
.gear { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.item-card { position: fixed; z-index: 11; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(320px, calc(100vw - 24px));
  background: rgba(20,16,13,.98); border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.item-card h3 { margin: 0 0 2px; font-size: 16px; }
.item-card .sub { margin: 0 0 8px; color: var(--muted); font-size: 12px; }
.item-card ul { margin: 0 0 10px; padding-left: 18px; font-size: 14px; }
.item-card .req.bad { color: #ff7b6b; }
.item-card .cmp { font-size: 13px; font-weight: 700; margin: -2px 0 10px; }
.item-card:has(.cmp-side) { width: min(560px, calc(100vw - 24px)); }
.cmp-side { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 4px 0 8px; }
.cmp-side > div:last-child { border-left: 1px solid var(--line); padding-left: 12px; }
.cmp-side .cmp-head { margin: 0 0 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.cmp-side .cmp-name { margin: 0; font-weight: 700; font-size: 14px; }
.cmp-side ul { margin: 0; padding-left: 16px; font-size: 13px; }
.cmp-side ul b { font-weight: 700; }
.item-card .actions { display: flex; flex-wrap: wrap; gap: 8px; } /* up to seven buttons: they wrap into rows of three */
.item-card .actions button { flex: 1 1 calc(33% - 8px); min-width: 0; padding: 9px 6px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.item-card .actions .main-action { background: var(--accent); color: #1a0f08; border-color: var(--accent); }
.jutsu.locked { filter: grayscale(1); opacity: .55; }
.jutsu.locked .jn::after { content: attr(data-lock); display: block; font-size: 10px; font-weight: 600; color: #ffb27a; }

/* ---------- Modes ---------- */
.mode-list { display: grid; gap: 8px; margin-top: 8px; }
.mode { --aura: var(--accent); display: flex; gap: 10px; align-items: center; background: var(--panel-2); border: 1px solid var(--line);
  border-left: 4px solid var(--aura); border-radius: 10px; padding: 8px 10px; }
.mode b { display: block; }
.mode p { margin: 2px 0; font-size: 12px; color: var(--muted); }
.mode span { font-size: 11px; color: var(--muted); }
.mode button { margin-left: auto; flex: none; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--aura); background: transparent;
  color: var(--text); font: inherit; font-weight: 700; cursor: pointer; }
.mode button:disabled { opacity: .5; cursor: default; }
.mode.active { box-shadow: 0 0 0 1px var(--aura) inset, 0 0 14px color-mix(in srgb, var(--aura) 40%, transparent); }
.mode.active button { background: var(--aura); color: #120e0c; }
.mode.locked { opacity: .6; }

/* ---------- Chat, party, invitations, duels ---------- */
.chat { position: fixed; left: max(8px, env(safe-area-inset-left)); bottom: max(132px, calc(env(safe-area-inset-bottom) + 128px));
  width: min(380px, calc(100vw - 230px)); min-width: 220px; pointer-events: none; }
.chat-log { max-height: 30vh; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; }
.chat-line { margin: 1px 0; font: 600 13px/1.35 system-ui, sans-serif; text-shadow: 0 1px 2px #000, 0 0 3px #000; word-break: break-word;
  transition: opacity .3s; }
.chat-form { display: none; margin-top: 6px; pointer-events: auto; }
.chat.open .chat-log { overflow-y: auto; pointer-events: auto; background: rgba(15,12,10,.7); border-radius: 8px; padding: 4px 6px; max-height: 38vh; }
.chat.open .chat-form { display: block; }
.chat-tabs { display: flex; gap: 4px; margin-bottom: 4px; }
.chat-tabs button { flex: 1; padding: 5px; border-radius: 6px; border: 1px solid var(--line); background: rgba(27,22,19,.92); color: var(--muted); font: 600 12px system-ui; cursor: pointer; }
.chat-tabs button[aria-pressed="true"] { color: #1a0f08; background: var(--accent); border-color: var(--accent); }
.chat-form input { width: 100%; padding: 9px 10px; border-radius: 8px; border: 1px solid var(--line); background: rgba(15,12,10,.95); color: var(--text); font: inherit; }
.topleft { position: fixed; left: max(8px, env(safe-area-inset-left)); top: max(8px, env(safe-area-inset-top)); width: min(240px, 46vw);
  display: grid; gap: 6px; pointer-events: none; }
.party { display: grid; gap: 4px; pointer-events: auto; }
/* the current story objective, always in sight; tap it for the diary */
.tracker { pointer-events: auto; background: rgba(0,0,0,.55); border-left: 3px solid var(--accent); border-radius: 8px; padding: 5px 8px;
  font: 600 12px/1.3 system-ui; text-shadow: 0 1px 2px #000; cursor: pointer; }
.tracker[hidden] { display: none; }
.tracker small { display: block; color: #e9ddd2; font-weight: 500; }
.tracker.done { border-left-color: #4fd16a; }
/* board missions under the story line: tap one for a route to that monster (or to Ikagura when it is done) */
.tracker .mission { margin-top: 3px; padding-top: 3px; border-top: 1px solid rgba(255,255,255,.12); color: #cfe3ff; }
.tracker .mission:hover { text-decoration: underline; }
.tracker .mission.done { color: #4fd16a; }
.party[hidden] { display: none; }
.party-member { position: relative; background: rgba(0,0,0,.55); border-radius: 5px; overflow: hidden; height: 18px; }
.party-member span { position: relative; z-index: 1; display: block; padding: 0 6px; font: 600 11px/18px system-ui; text-shadow: 0 1px 2px #000; }
.party-member i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(#3fae3f, #2a7a2a); transition: width .3s; }
.party button { justify-self: start; padding: 3px 8px; border-radius: 6px; border: 1px solid var(--line); background: rgba(27,22,19,.9); color: var(--muted); font: 600 11px system-ui; cursor: pointer; }
.duel-banner { position: fixed; left: 50%; top: max(60px, calc(env(safe-area-inset-top) + 56px)); transform: translateX(-50%); margin: 0;
  padding: 6px 14px; border-radius: 10px; background: rgba(120,20,15,.9); border: 1px solid #ff6a4a; font-weight: 800; pointer-events: none; }
.duel-banner[hidden], .invite[hidden], .pmenu[hidden], .profile[hidden] { display: none; }
.duel-banner { display: flex; gap: 10px; align-items: center; pointer-events: auto; }
.duel-banner button { padding: 4px 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,.4); background: rgba(0,0,0,.35); color: var(--text); font: 600 12px system-ui; cursor: pointer; }
.duel-banner.ranked { background: rgba(80,40,120,.92); border-color: #b874ff; }
.invite { position: fixed; z-index: 13; left: 50%; bottom: max(150px, 22vh); transform: translateX(-50%); width: min(320px, calc(100vw - 24px));
  background: rgba(20,16,13,.97); border: 2px solid var(--accent); border-radius: 12px; padding: 10px 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.invite p { flex-basis: 100%; margin: 0 0 4px; font-weight: 700; }
.invite button, .pmenu button, .profile button { flex: 1; padding: 9px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2);
  color: var(--text); font: inherit; font-weight: 700; cursor: pointer; }
.invite .main-action { background: var(--accent); color: #1a0f08; border-color: var(--accent); }
.pmenu { position: fixed; z-index: 13; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(260px, calc(100vw - 24px));
  background: rgba(20,16,13,.97); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 6px; }
.pmenu h3 { margin: 0 0 4px; }
.profile-gear { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin: 4px 0 10px; color: var(--muted); font-size: 13px; }

/* ---------- Jutsu book ---------- */
.book-bar { display: flex; gap: 6px; flex-wrap: wrap; }
.bar-slot { flex: 1 1 70px; min-height: 44px; padding: 6px; border-radius: 10px; border: 2px solid var(--line); background: #0f0c0a; color: var(--text);
  font: 700 12px/1.2 system-ui; display: grid; place-items: center; text-align: center; cursor: pointer; }
.bar-slot.fixed { color: var(--muted); border-style: dashed; cursor: default; }
.bar-slot.empty { color: var(--muted); border-style: dashed; }
.bar-slot kbd { display: block; font: 600 10px system-ui; color: var(--muted); }
.book-jutsu .mode-pick { margin-top: 0; }
.bar-slot.picked, .book-jutsu.picked { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(240,122,34,.4); }
.book-list { display: grid; gap: 6px; }
.book-jutsu { background: var(--panel-2); border: 2px solid var(--line); border-radius: 10px; padding: 6px 10px; cursor: pointer; }
.book-jutsu b { display: block; font-size: 14px; }
.book-jutsu p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.book-jutsu.equipped { border-left: 4px solid var(--accent); }
.book-jutsu.locked { opacity: .5; cursor: default; }

/* ---------- Trials ---------- */
.trial-banner { position: fixed; left: 50%; top: max(60px, calc(env(safe-area-inset-top) + 56px)); transform: translateX(-50%);
  display: flex; gap: 10px; align-items: center; padding: 6px 8px 6px 14px; border-radius: 10px; background: rgba(60,40,10,.92);
  border: 1px solid #ffd23a; font-weight: 800; }
.trial-banner[hidden], .trial-offer[hidden] { display: none; }
.trial-banner button { padding: 5px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font: 600 12px system-ui; cursor: pointer; }
.trial-offer { width: min(360px, calc(100vw - 24px)); max-height: 80vh; overflow: auto; }
.trial-row { background: var(--panel-2); border-radius: 10px; padding: 8px 10px; display: grid; gap: 6px; }
.trial-row p { margin: 0; font-size: 13px; color: var(--muted); }
.trial-row .why { color: #ffb27a; }
.trial-offer .main-action { background: var(--accent); color: #1a0f08; border-color: var(--accent); }

/* ---------- Economy ---------- */
.ryo { color: #ffd23a; }
.inv header span { display: flex; gap: 6px; align-items: center; }
.small { padding: 4px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font: 600 12px system-ui; cursor: pointer; }
.slot .lock { position: absolute; top: 1px; right: 2px; font-size: 10px; }
.npc[hidden] { display: none; }
.npc-body { display: grid; gap: 6px; margin-top: 8px; }
.npc-row { display: flex; gap: 8px; align-items: center; background: var(--panel-2); border-radius: 8px; padding: 6px 8px; }
.npc-row .item-name { flex: 1; font-size: 13px; font-weight: 700; }
.npc-row .price { color: #ffd23a; font-size: 12px; white-space: nowrap; }
.npc-row button, .npc-body > button { padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: #0f0c0a; color: var(--text);
  font: 700 12px system-ui; cursor: pointer; }
.npc-row button:disabled { opacity: .45; cursor: default; }
.npc-body .main-action { background: var(--accent); color: #1a0f08; border-color: var(--accent); }
.npc-body .wide { width: 100%; padding: 10px; }
.mini-icon { width: 28px; height: 28px; object-fit: contain; image-rendering: pixelated; }
.big-icon { font-size: 22px; }
.rank-badge { min-width: 24px; text-align: center; padding: 2px 6px; border-radius: 6px; background: var(--accent); color: #1a0f08; font-weight: 800; }
.npc h3 { margin: 8px 0 2px; font-size: 13px; color: var(--muted); }


/* ---------- Boss bar ---------- */
.boss-bar { position: fixed; left: 50%; top: max(104px, calc(env(safe-area-inset-top) + 100px)); transform: translateX(-50%); width: min(420px, 70vw);
  text-align: center; pointer-events: none; }
.boss-bar[hidden] { display: none; }
.boss-bar span { font: 800 14px system-ui; text-shadow: 0 1px 3px #000; color: #ffb4a8; }
.boss-bar div { margin-top: 3px; height: 12px; border-radius: 6px; background: rgba(0,0,0,.7); border: 1px solid #7a1a12; overflow: hidden; }
.boss-bar i { display: block; height: 100%; background: linear-gradient(#e2483c, #8f1a10); transition: width .25s; }

/* ---------- Loot bags ---------- */
.lootbag { left: 50%; right: auto; top: auto; bottom: max(150px, 20vh); transform: translateX(-50%); width: min(400px, calc(100vw - 16px));
  max-height: 60vh; }
.lootbag[hidden] { display: none; }
.bag-item { display: flex; gap: 10px; align-items: center; margin-top: 8px; padding: 8px; background: var(--panel-2); border: 1px solid; border-left-width: 4px; border-radius: 10px; }
.bag-item img { width: 40px; height: 40px; object-fit: contain; image-rendering: pixelated; flex: none; }
.bag-item > div { flex: 1; min-width: 0; }
.bag-item b { font-size: 14px; }
.bag-item p { margin: 2px 0 0; font-size: 12px; }
.bag-item .sub { color: var(--muted); }
.bag-item .sub.bad { color: #ff7b6b; }
.bag-item .lines { color: var(--text); }
.bag-item .cmp { color: var(--muted); }
.lootbag button.main-action { padding: 8px 12px; border-radius: 8px; border: 0; background: var(--accent); color: #1a0f08; font: 700 13px system-ui; cursor: pointer; }
.lootbag .wide { width: 100%; margin-top: 10px; padding: 10px; }

/* ---------- Phone held upright ---------- */
@media (orientation: portrait) and (max-width: 700px) {
  /* menu buttons in a column on the right edge, so the bars get the whole top */
  .top-buttons { flex-direction: column; gap: 6px; top: max(8px, env(safe-area-inset-top)); right: max(8px, env(safe-area-inset-right)); }
  .top-buttons button { width: 42px; height: 42px; font-size: 20px; border-radius: 10px; }
  .bar { height: 15px; }
  .bar span { line-height: 15px; }
  /* the dock takes the whole width: two rows of five slots beside a big basic attack */
  .dock { left: 8px; right: 8px; transform: none; padding: 6px 8px 5px; gap: 5px; }
  .dock::before, .dock::after { display: none; }
  .jutsus { display: grid; grid-template-columns: 40px repeat(5, 40px) 72px; grid-template-rows: 40px 40px; gap: 6px; justify-content: center; }
  .jutsu { width: 40px; height: 40px; }
  .jutsu-guard { grid-column: 1; grid-row: 1; width: 40px; height: 40px; }
  .jutsu-right { grid-column: 1; grid-row: 2; width: 40px; height: 40px; border-radius: 10px; }
  .jutsu-basic { grid-column: 7; grid-row: 1 / span 2; width: 72px; height: 72px; align-self: end; }
  .cancel { bottom: calc(max(8px, env(safe-area-inset-bottom)) + 172px); width: min(196px, 70vw); }
  /* the chat sits above the dock */
  .chat { bottom: max(166px, calc(env(safe-area-inset-bottom) + 162px)); width: calc(100vw - 72px); min-width: 150px; }
  .chat.open { width: calc(100vw - 16px); bottom: max(166px, calc(env(safe-area-inset-bottom) + 162px)); z-index: 14; }
  .chat-line { font-size: 12px; }
  /* coordinates are for testing; on a phone they only get in the way */
  #pos { display: none; }
  .duel-banner, .trial-banner { top: auto; bottom: max(260px, 32vh); }
  .boss-bar { top: max(76px, calc(env(safe-area-inset-top) + 72px)); width: calc(100vw - 80px); left: 8px; transform: none; }
  .topleft { width: calc(100vw - 72px); }
}

/* ---------- Minimap and world map ---------- */
.minimap { position: fixed; right: max(12px, env(safe-area-inset-right)); top: calc(max(8px, env(safe-area-inset-top)) + 54px);
  width: 150px; height: 150px; border-radius: 12px; border: 2px solid var(--line); background: #0c0a09; cursor: pointer; }
#hud[hidden] .minimap { display: none; }
/* the route you follow, under the minimap: tap it (or Esc) to cancel */
.route-chip { position: fixed; right: max(12px, env(safe-area-inset-right)); top: calc(max(8px, env(safe-area-inset-top)) + 212px); max-width: 150px;
  padding: 5px 10px; border-radius: 8px; border: 1px solid #c9a46a; background: rgba(27,22,19,.92); color: #ffd27a; font: 600 12px system-ui, sans-serif;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.route-chip:hover { background: rgba(80,30,20,.95); }
.route-chip[hidden], #hud[hidden] .route-chip { display: none; }
.worldmap { position: fixed; inset: 0; z-index: 20; background: #0c0a09; }
.worldmap[hidden] { display: none; }
.worldmap canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.wm-tools { position: absolute; top: max(8px, env(safe-area-inset-top)); right: max(8px, env(safe-area-inset-right)); display: flex; gap: 6px; align-items: center; }
.wm-tools button, .wm-tools span { background: rgba(27,22,19,.92); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font: 600 13px system-ui; }
.wm-tools button { cursor: pointer; }
.wm-tools button[hidden] { display: none; }
.wm-list { position: absolute; left: max(8px, env(safe-area-inset-left)); top: max(8px, env(safe-area-inset-top)); bottom: 8px; width: min(280px, 46vw);
  overflow: auto; background: rgba(20,16,13,.9); border: 1px solid var(--line); border-radius: 12px; padding: 6px 8px; }
.wm-list h3 { margin: 8px 2px 4px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.wm-list button { display: grid; grid-template-columns: 26px 1fr; text-align: left; width: 100%; padding: 6px; margin-bottom: 4px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text); cursor: pointer; }
.wm-list button span { grid-row: span 2; font-size: 18px; align-self: center; }
.wm-list button b { font-size: 13px; }
.wm-list button small { color: var(--muted); font-size: 11px; }
.wm-hint { position: absolute; left: 50%; bottom: max(10px, env(safe-area-inset-bottom)); transform: translateX(-50%); margin: 0;
  background: rgba(27,22,19,.9); padding: 6px 12px; border-radius: 8px; color: var(--muted); font-size: 12px; pointer-events: none; }
@media (orientation: portrait) and (max-width: 700px) {
  .minimap { right: auto; left: max(8px, env(safe-area-inset-left)); top: calc(max(8px, env(safe-area-inset-top)) + 80px); width: 110px; height: 110px; }
  .route-chip { right: auto; left: max(8px, env(safe-area-inset-left)); top: calc(max(8px, env(safe-area-inset-top)) + 196px); max-width: 110px; }
  .wm-list { top: auto; bottom: 46px; width: auto; right: 8px; height: 34vh; }
  .wm-hint { display: none; }
}

/* ---------- Continue playing ---------- */
.char-continue { display: grid; grid-template-columns: 96px 1fr; gap: 6px 12px; align-items: center; padding: 10px;
  background: var(--panel-2); border: 1px solid var(--accent); border-radius: 12px; margin-bottom: 12px; }
.char-continue[hidden], .create[hidden], #create-toggle[hidden], #others-title[hidden], #resume-btn[hidden] { display: none; }
.char-continue canvas { width: 96px; height: 96px; image-rendering: pixelated; grid-row: span 2; }
.char-continue b { font-size: 20px; display: block; }
.char-continue span { color: var(--muted); font-size: 13px; }
.char-continue .primary { margin: 0; grid-column: 2; }
.link { display: block; margin: 12px auto 0; background: none; border: 0; color: var(--muted); text-decoration: underline; font: inherit; font-size: 13px; cursor: pointer; }
.reconnecting { position: fixed; z-index: 30; left: 50%; top: 40%; transform: translateX(-50%); margin: 0; padding: 10px 18px; border-radius: 12px;
  background: rgba(20,16,13,.95); border: 1px solid var(--accent); font-weight: 700; }
.reconnecting[hidden] { display: none; }

/* ---------- Training ---------- */
.learn-offer { position: fixed; z-index: 9; left: 50%; bottom: max(150px, calc(env(safe-area-inset-bottom) + 150px)); transform: translateX(-50%);
  width: min(360px, calc(100vw - 32px)); background: rgba(27,22,19,.97); border: 2px solid var(--accent); border-radius: 14px; padding: 10px 12px; }
.learn-offer[hidden] { display: none; }
.learn-offer h3 { margin: 0 0 8px; font-size: 15px; color: var(--accent); }
.learn-row { display: flex; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.learn-row b { font-size: 14px; }
.learn-offer .main-action, .book-jutsu .main-action { padding: 8px 12px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent);
  color: #1a0f08; font: inherit; font-weight: 700; cursor: pointer; white-space: nowrap; }
.book-jutsu.learnable { border-left: 4px solid #ffd23a; }
.book-jutsu .main-action { margin-top: 6px; }
.cc-box p { margin: 0 0 4px; font-size: 13px; color: var(--muted); }
.cc-box .secondary:disabled { opacity: .6; cursor: default; }
.train { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(0,0,0,.55); }
.train-card { background: rgba(27,22,19,.98); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px 12px; max-width: calc(100vw - 16px); }
.train-card header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.train-card h2 { margin: 0; font-size: 17px; }
.train-card canvas { display: block; border-radius: 10px; touch-action: none; user-select: none; -webkit-user-select: none; }
.train-hint { margin: 8px 0 0; font-size: 12px; color: var(--muted); max-width: 560px; }

/* ---------- Menu: one window, tabs on the left (on top on a phone) ---------- */
.menu { position: fixed; z-index: 10; inset: 0; margin: auto; width: min(880px, calc(100vw - 16px)); height: min(580px, calc(100vh - 16px));
  display: grid; grid-template-columns: 78px 1fr; background: rgba(20,16,13,.97); border: 1px solid var(--line); border-radius: 16px;
  overflow: hidden; box-shadow: 0 14px 40px rgba(0,0,0,.6); }
.menu[hidden], .menu-page[hidden] { display: none; }
.menu-tabs { display: flex; flex-direction: column; gap: 6px; padding: 10px 8px; background: #120e0c; border-right: 1px solid var(--line); }
.menu-tabs button[data-tab] { display: grid; justify-items: center; gap: 2px; padding: 6px 2px; border-radius: 10px; border: 1px solid transparent;
  background: none; color: var(--muted); font: 600 10px system-ui; cursor: pointer; }
.menu-tabs button[data-tab]:hover { border-color: var(--line); }
.menu-tabs button[aria-selected="true"] { background: var(--accent); color: #1a0f08; }
.menu-tabs i { font-style: normal; font-size: 22px; line-height: 1; }
.menu-close { margin-top: auto; align-self: center; }
.menu-body { overflow: auto; padding: 14px 16px; }
.menu-page h2 { margin: 0 0 4px; font-size: 18px; }
.menu-page h3 { margin: 12px 0 6px; font-size: 14px; color: var(--muted); }

/* equipment: the character on a pedestal with the worn slots beside it, the bag on the right */
.equip-page { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: start; }
.equip-page > * { min-width: 0; } /* a grid track never grows past the panel: the bag wraps instead of scrolling sideways */
.hero { display: grid; grid-template-columns: auto auto; gap: 12px; align-items: center; justify-content: center; }
.hero .gear, .hero .attrs { grid-column: 1 / -1; }
.hero .gear { max-width: 300px; }
.stage { position: relative; width: 150px; padding-bottom: 40px; display: grid; justify-items: center;
  background: radial-gradient(circle at 50% 42%, rgba(240,122,34,.14), transparent 62%); }
.stage::before { content: ''; position: absolute; left: 50%; bottom: 34px; width: 124px; height: 30px; transform: translateX(-50%); border-radius: 50%;
  background: radial-gradient(ellipse at 50% 35%, #6a5b4f, #2e2620 72%); box-shadow: 0 6px 0 #17110e, 0 0 26px rgba(240,122,34,.16); }
.stage canvas { position: relative; width: 128px; height: 128px; image-rendering: pixelated; margin-bottom: -14px; }
.turn { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; }
.turn button { width: 36px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font-size: 16px; cursor: pointer; }
.bag-tools { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.bag-tools .chips { flex: 1; }
.bag-tools .small[aria-pressed="true"] { background: var(--accent); color: #1a0f08; border-color: var(--accent); }
.item-card .cmp-all, .tip .cmp-all { margin: 0 0 8px; padding-left: 4px; list-style: none; font-size: 13px; font-weight: 600; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chips button { padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted);
  font: 600 12px system-ui; cursor: pointer; }
.chips button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #1a0f08; }

/* the bestiary: one card per kind of monster, coloured by the tier reached */
.best-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin-top: 10px; }
.best-card { display: grid; grid-template-columns: 52px 1fr; gap: 1px 8px; align-items: center; padding: 8px; border-radius: 12px;
  border: 2px solid var(--line); background: var(--panel-2); }
.best-card canvas { width: 52px; height: 52px; image-rendering: pixelated; grid-row: span 4; align-self: center; }
.best-card b { font-size: 13px; line-height: 1.2; }
.best-card small { font-size: 11px; color: var(--muted); }
.best-card .small { grid-column: 2; justify-self: start; margin-top: 4px; }
.best-card .best-bar { height: 5px; margin-top: 3px; border-radius: 3px; background: rgba(0,0,0,.6); overflow: hidden; }
.best-card .best-bar i { display: block; height: 100%; background: var(--accent); }
.best-card.t0 { border-color: #4fd16a; } .best-card.t1 { border-color: #b874ff; }
.best-card.t2 { border-color: #ff9a2e; box-shadow: 0 0 8px rgba(255,154,46,.4); }
.best-card.unknown { opacity: .6; } .best-card.unknown canvas { filter: grayscale(1) brightness(.6); }
.best-card.boss b::before { content: '👑 '; }
/* an item linked in the chat, and the one about to be sent */
.chat-line .item-link { font-weight: 800; text-decoration: underline dotted; cursor: pointer; pointer-events: auto; }
.chat-line .chat-name { cursor: pointer; pointer-events: auto; }
.chat-line .chat-name:hover { text-decoration: underline; }
.chat-line .chat-reply { pointer-events: auto; cursor: pointer; border: 1px solid rgba(255,154,213,.6); background: rgba(0,0,0,.45); color: inherit; border-radius: 6px; font: 700 12px/1 system-ui, sans-serif; padding: 1px 6px; vertical-align: middle; }
.chat-line .chat-reply:hover { background: rgba(255,154,213,.3); }
.chat-attach { display: flex; gap: 8px; align-items: center; margin-top: 4px; padding: 4px 8px; border-radius: 6px;
  background: rgba(15,12,10,.85); font: 600 12px system-ui; }
.chat-attach[hidden] { display: none; }
.chat-attach button { margin-left: auto; padding: 2px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); font: 600 11px system-ui; cursor: pointer; }
.power { color: #ffd23a; font-weight: 700; }

/* ---------- Story ---------- */
.quest-talk { position: fixed; z-index: 9; left: 50%; bottom: max(150px, calc(env(safe-area-inset-bottom) + 150px)); transform: translateX(-50%);
  width: min(440px, calc(100vw - 32px)); background: rgba(27,22,19,.97); border: 2px solid #c9a46a; border-radius: 14px; padding: 10px 14px; }
.quest-talk[hidden] { display: none; }
.quest-talk h3 { margin: 0; font-size: 12px; color: #c9a46a; text-transform: uppercase; letter-spacing: .05em; }
.quest-talk b { display: block; font-size: 16px; margin: 2px 0 6px; }
.quest-talk p { margin: 0 0 8px; font-size: 14px; line-height: 1.45; }
.quest-talk .reward { color: #ffd27a; font-size: 13px; }
.quest-talk .actions { display: flex; gap: 8px; }
.quest-talk .actions button { flex: 1; padding: 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font: inherit; font-weight: 700; cursor: pointer; }
.quest-talk .actions .main-action { background: var(--accent); color: #1a0f08; border-color: var(--accent); }
.story-quest { background: var(--panel-2); border-left: 4px solid var(--accent); border-radius: 10px; padding: 10px 12px; margin: 8px 0; }
.story-quest b { font-size: 15px; }
.story-quest p { margin: 4px 0; }
.story-line { font-weight: 700; color: #ffd27a; }
.story-line.done { color: #4fd16a; }
.story-quest button { margin-top: 6px; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: #1a0f08; font: inherit; font-weight: 700; cursor: pointer; }
.story-list { margin: 10px 0 0; padding-left: 22px; color: var(--muted); font-size: 13px; }
.story-list .done { text-decoration: line-through; opacity: .7; }
.story-list .now { color: var(--text); font-weight: 700; }
/* a shrine you know: the row plus a small travel button beside it (the cost, or the wait until you can travel again) */
.wm-row { display: grid; grid-template-columns: 1fr auto; gap: 4px; margin-bottom: 4px; }
.wm-row button { margin-bottom: 0; }
.wm-list .wm-travel { display: grid; grid-template-columns: 1fr; justify-items: center; align-content: center; gap: 1px; width: auto; min-width: 64px; padding: 4px 8px;
  border-color: #6cc8ff; background: rgba(40,80,110,.5); text-align: center; }
.wm-list .wm-travel b { font-size: 12px; }
.wm-list .wm-travel small { font-size: 11px; }
.wm-list .wm-travel:disabled { border-color: var(--line); background: var(--panel-2); color: var(--muted); cursor: default; }

/* ---------- Attributes and settings ---------- */
.attrs { margin-top: 10px; display: grid; gap: 6px; }
.attrs .head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.attrs .head b { color: #ffd27a; }
.attr { display: grid; grid-template-columns: 24px 1fr auto; gap: 2px 8px; align-items: center; background: var(--panel-2); border-radius: 10px; padding: 6px 8px; }
.attr i { grid-row: span 2; font-style: normal; font-size: 18px; text-align: center; }
.attr b { font-size: 13px; }
.attr small { grid-column: 2; color: var(--muted); font-size: 11px; }
.attr .plus { grid-row: span 2; display: flex; gap: 4px; }
.attr .plus button, .attrs .small { padding: 4px 8px; border-radius: 6px; border: 1px solid var(--line); background: #0f0c0a; color: var(--text); font: 700 12px system-ui; cursor: pointer; }
.attr .plus button:disabled { opacity: .4; cursor: default; }
.keys-list { display: grid; gap: 4px; margin-bottom: 8px; }
.keyrow { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; background: var(--panel-2); border-radius: 8px; padding: 5px 8px; font-size: 13px; }
.keyrow kbd { min-width: 54px; text-align: center; padding: 2px 8px; border-radius: 6px; border: 1px solid var(--line); background: #0f0c0a; font: 700 12px ui-monospace, monospace; }
.keyrow.waiting kbd { border-color: var(--accent); color: var(--accent); }
.options { display: grid; gap: 6px; }
.options label { display: flex; gap: 10px; align-items: center; background: var(--panel-2); border-radius: 8px; padding: 8px 10px; font-size: 13px; cursor: pointer; }
.options input { width: 18px; height: 18px; accent-color: var(--accent); }
.market-filter, .market-form input, .market-form select, .market-amount { padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: rgba(15,12,10,.95); color: var(--text); font: inherit; }
.market-filter { width: 100%; }
.market-amount { width: 84px; }
.market-row .market-text { flex: 1; min-width: 0; display: grid; }
.market-row .item-name { flex: none; }
.market-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; background: var(--panel-2); border-radius: 8px; padding: 8px; }
.market-form input { width: 120px; }
.npc .slot.picked { outline: 2px solid var(--accent); outline-offset: -3px; }
.report { display: grid; gap: 6px; margin-bottom: 8px; }
.report select, .report textarea { width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: rgba(15,12,10,.95); color: var(--text); font: inherit; }
.report textarea { resize: vertical; min-height: 80px; }
.report button { justify-self: start; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: #1a0f08; font: inherit; font-weight: 700; cursor: pointer; }
.report button:disabled { opacity: .5; cursor: default; }

/* ---------- The Chunin Exams and squads ---------- */
.me-rank { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: center; background: var(--panel-2); border-radius: 12px; padding: 10px 12px; margin: 8px 0; }
.me-rank .big { font-size: 28px; font-weight: 800; }
.me-rank .league { font-weight: 700; }
.me-rank small { color: var(--muted); }
.ranked-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ranked-table td, .ranked-table th { padding: 5px 6px; border-top: 1px solid var(--line); text-align: left; }
.ranked-table th { color: var(--muted); font-weight: 600; font-size: 12px; }
.ranked-table td.n { color: var(--muted); width: 28px; }
.ranked-table td.r { font-weight: 700; text-align: right; }
.ranked-table tr.me td { color: #ffd27a; }
.guild-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.guild-head b { font-size: 18px; }
.guild-head .tag { color: #c9a46a; font-weight: 800; }
.guild-motd { margin: 6px 0 10px; padding: 8px 10px; border-left: 3px solid #c9a46a; background: var(--panel-2); border-radius: 8px; font-style: italic; }
.guild-form { display: grid; gap: 6px; margin: 8px 0; }
.guild-form input { background: #0f0c0a; color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; }
.guild-form .row { display: flex; gap: 6px; }
.guild-form .row input:first-child { flex: 1; min-width: 0; }
.guild-form .row input:last-child { width: 90px; }
.friend .rank-badge { background: var(--panel); color: #c9a46a; font-size: 11px; }
.guild-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

/* ---------- Achievements ---------- */
.ach-list { display: grid; gap: 6px; margin-top: 6px; }
.ach { display: grid; grid-template-columns: 28px 1fr auto; gap: 2px 10px; align-items: center; background: var(--panel-2); border-radius: 10px; padding: 8px 10px; }
.ach i { grid-row: span 2; font-style: normal; font-size: 20px; text-align: center; }
.ach b { font-size: 14px; }
.ach small { grid-column: 2; color: var(--muted); font-size: 12px; }
.ach .pts { grid-row: span 2; color: #ffd27a; font-weight: 700; font-size: 13px; white-space: nowrap; }
.ach.todo { opacity: .55; }
.ach.todo i { filter: grayscale(1); }
.ach .badge { color: #c9a46a; }

/* ---------- Trade ---------- */
.trade { width: min(440px, calc(100vw - 16px)); z-index: 12; }
.trade-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.trade-side { background: var(--panel-2); border-radius: 10px; padding: 8px; }
.trade-side h3 { margin: 0 0 6px; }
.trade-side.ok h3::after { content: ' ✔ confirmado'; color: #4fd16a; font-size: 11px; }
.trade .bag { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 5px; }
.trade .bag:empty::before { content: 'Nada todavía'; color: var(--muted); font-size: 12px; }
.trade .slot.picked { outline: 2px solid var(--accent); outline-offset: -3px; }
.trade .field { margin-top: 8px; }
.trade .field input { width: 100%; }
.trade-status { min-height: 1.4em; margin: 8px 0 0; font-weight: 700; color: #ffd27a; font-size: 13px; }
.trade .actions { display: flex; gap: 8px; margin-top: 8px; }
.trade .actions button { flex: 1; padding: 9px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font: inherit; font-weight: 700; cursor: pointer; }
.trade .actions .main-action { background: var(--accent); color: #1a0f08; border-color: var(--accent); }
.trade .actions .main-action[aria-pressed="true"] { background: #4fd16a; border-color: #4fd16a; }

/* ---------- Friends ---------- */
.friend-add { display: flex; gap: 6px; margin: 8px 0; }
.friend-add input { flex: 1; min-width: 0; background: #0f0c0a; color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; }
.friend-list { display: grid; gap: 6px; }
.friend-list:empty::before { content: 'Todavía no tienes amigos en la lista.'; color: var(--muted); font-size: 13px; }
.friend { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: var(--panel-2); border-radius: 10px; padding: 6px 10px; }
.friend .dot { width: 10px; height: 10px; border-radius: 50%; background: #666; flex: none; }
.friend.online .dot { background: #4fd16a; box-shadow: 0 0 6px #4fd16a; }
.friend b { flex: 1; min-width: 90px; }
.friend small { color: var(--muted); }
.friend button { padding: 4px 8px; border-radius: 6px; border: 1px solid var(--line); background: #0f0c0a; color: var(--text); font: 600 12px system-ui; cursor: pointer; }
.chat-line.offline { font-style: italic; }

/* summons as cards */
.pet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-top: 10px; }
.pet-card { display: grid; justify-items: center; gap: 2px; padding: 10px 8px; border-radius: 12px; border: 2px solid var(--line);
  background: var(--panel-2); color: var(--text); font: inherit; text-align: center; cursor: pointer; }
.pet-card canvas { width: 64px; height: 64px; image-rendering: pixelated; }
.pet-card b { font-size: 14px; }
.pet-card span { font-size: 12px; color: #ffd27a; }
.pet-card small { font-size: 11px; color: var(--muted); }
.pet-card.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(240,122,34,.35); }
.pet-card:not(.locked):hover { border-color: var(--accent); }
.pet-card.locked { opacity: .55; cursor: default; }
.pet-card.locked canvas { filter: grayscale(1) brightness(.7); }

@media (max-width: 700px), (max-height: 480px) {
  .menu { width: 100vw; height: 100dvh; border: 0; border-radius: 0; grid-template-columns: 1fr; grid-template-rows: auto 1fr;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); }
  .menu-tabs { flex-direction: row; border-right: 0; border-bottom: 1px solid var(--line); padding: 6px 8px; overflow-x: auto; }
  .menu-tabs button[data-tab] { flex: 1; min-width: 34px; padding: 6px 0; }
  .menu-tabs button[data-tab] span { display: none; } /* ten tabs: icons only on a phone, the title says where you are */
  .menu-close { margin: 0 0 0 4px; }
}
@media (max-width: 700px) {
  .equip-page { grid-template-columns: 1fr; gap: 12px; }
  .equip { grid-template-columns: repeat(3, 50px); grid-template-rows: repeat(4, 50px); gap: 5px; }
  .stage { width: 128px; }
  .hero .gear { max-width: none; }
}

/* phone on its side: smaller slots, a slimmer dock */
@media (hover: none) and (orientation: landscape) {
  .dock { padding: 5px 34px 4px; gap: 4px; bottom: max(4px, env(safe-area-inset-bottom)); }
  .dock::before, .dock::after { font-size: 22px; }
  .bar { height: 13px; }
  .bar span { line-height: 13px; font-size: 10px; }
  .jutsu { width: 44px; height: 44px; }
  .jutsu-basic { width: 60px; height: 60px; }
  .jutsu-guard { width: 44px; height: 44px; }
  .cancel { bottom: calc(max(4px, env(safe-area-inset-bottom)) + 112px); }
  .chat { bottom: max(112px, calc(env(safe-area-inset-bottom) + 108px)); }
}

/* new version notice: 1 a small card you can close, 2 a banner that stays, 3 a screen over everything */
.update { position: fixed; z-index: 50; left: 50%; transform: translateX(-50%); top: max(10px, env(safe-area-inset-top));
  width: min(420px, calc(100vw - 24px)); padding: 12px 14px; border-radius: 12px; background: rgba(27,22,19,.96);
  border: 2px solid var(--line); color: var(--text); box-shadow: 0 6px 24px rgba(0,0,0,.5); }
.update[hidden] { display: none; }
.update b { display: block; font-size: 15px; }
.update p { margin: 6px 0 0; font-size: 13px; color: var(--muted); white-space: pre-line; }
.update-actions { display: flex; gap: 8px; margin-top: 10px; }
.update-actions button { flex: 1; padding: 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2);
  color: var(--text); font: inherit; font-weight: 700; cursor: pointer; }
.update-actions .main-action { background: var(--accent); border-color: var(--accent); color: #1b1613; }
.update-1 { border-color: #6cc8ff; }
.update-2 { border-color: var(--accent); background: rgba(60,30,10,.97); }
.update-3 { border-color: #ff6b5b; background: rgba(70,14,10,.96); }
.update-3 b { color: #ff9a85; }
.update-count { color: var(--text) !important; font-weight: 700; }
/* in the game it is a slim strip under the bars, so it never hides what is around you */
@media (max-width: 700px) { .update { top: auto; bottom: max(190px, calc(env(safe-area-inset-bottom) + 186px)); padding: 9px 11px; }
  .update p { font-size: 12px; } }

/* PC: the menu is a panel on the right that leaves the game visible and playable (keys, clicks and the chat keep
   working); the minimap, the NPC panel and the item card move out from under it */
@media (hover: hover) and (min-width: 1000px) and (min-height: 560px) {
  .menu { inset: auto; top: 62px; right: max(8px, env(safe-area-inset-right)); bottom: 140px; margin: 0; width: 470px; height: auto; }
  .equip-page { grid-template-columns: 1fr; gap: 12px; }
  .hero .gear { max-width: none; }
  body.menu-open .minimap, body.menu-open .route-chip, body.menu-open .npc { right: calc(max(8px, env(safe-area-inset-right)) + 478px); }
  body.menu-open #item { left: auto; right: calc(max(8px, env(safe-area-inset-right)) + 478px); top: 80px; transform: none; }
}

/* language buttons on the login screen */
.lang-pick { display: flex; gap: 6px; justify-content: flex-end; margin: -6px 0 8px; }
.lang-pick button { padding: 4px 10px; font-size: 12px; font-weight: 700; border-radius: 999px; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); }
.lang-pick button[aria-pressed="true"] { background: var(--accent); color: #1a0f08; border-color: var(--accent); }

/* ---------- Loot straight into the bag: a little box with the item and how many ---------- */
.pickups { position: fixed; z-index: 8; right: max(10px, env(safe-area-inset-right)); top: 34%; display: flex; flex-direction: column;
  align-items: flex-end; gap: 6px; pointer-events: none; }
.pickup { display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; background: rgba(27,22,19,.92); border: 1px solid var(--line);
  border-left: 3px solid #d9d4cc; border-radius: 8px; font: 600 13px system-ui, sans-serif; color: var(--text);
  animation: pickup-in .25s ease-out; transition: opacity .3s, transform .3s; }
.pickup .slot { width: 36px; height: 36px; display: grid; place-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; }
.pickup .slot img, .pickup .slot span { width: 32px; height: 32px; image-rendering: pixelated; font-size: 22px; line-height: 32px; text-align: center; }
.pickup b { color: #ffd23a; font-size: 16px; min-width: 2.2ch; }
.pickup.bump b { animation: pickup-bump .3s ease-out; display: inline-block; }
.pickup.out { opacity: 0; transform: translateX(24px); }
@keyframes pickup-in { from { opacity: 0; transform: translateX(28px) scale(.9); } }
@keyframes pickup-bump { 40% { transform: scale(1.5); color: #fff6c8; } }

/* ---------- Boss loot: face down (a black silhouette), then turned over one by one ---------- */
.reveal { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  padding: 16px; background: radial-gradient(circle at 50% 45%, rgba(40,24,12,.6), rgba(0,0,0,.88)); overflow-y: auto; }
.reveal[hidden] { display: none; }
.reveal h2 { margin: 0; font: 800 22px system-ui, sans-serif; letter-spacing: .06em; color: #ffd23a; text-shadow: 0 2px 8px #000; text-align: center; }
.reveal .cards { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; max-width: 920px; }
.reveal-card { --rc: var(--line); width: 210px; min-height: 270px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 12px;
  background: var(--panel); border: 2px solid var(--line); border-radius: 14px; text-align: center; transition: opacity .3s, filter .3s; }
.reveal-card .art { position: relative; width: 104px; height: 104px; display: grid; place-items: center; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.08), transparent 70%); }
.reveal-card .art img, .reveal-card .art span { position: relative; width: 64px; height: 64px; image-rendering: pixelated; font-size: 44px; line-height: 64px; }
.reveal-card.hidden .art img, .reveal-card.hidden .art span { filter: brightness(0) drop-shadow(0 0 2px rgba(255,255,255,.85)); animation: reveal-shiver .09s infinite alternate; }
.reveal-card.hidden .art { animation: reveal-pulse .8s ease-in-out infinite; }
.reveal-card .name { margin: 4px 0 0; font: 800 15px system-ui, sans-serif; }
.reveal-card.hidden .name { color: var(--muted); letter-spacing: .3em; }
.reveal-card .sub { margin: 0; font-size: 12px; color: var(--muted); }
.reveal-card .sub.bad { color: #ff6b5b; }
.reveal-card ul { margin: 2px 0; padding: 0; list-style: none; font-size: 12px; line-height: 1.45; }
.reveal-card .cmp { margin: 0; font-size: 12px; color: var(--muted); }
.reveal-card .actions { margin-top: auto; display: flex; gap: 6px; width: 100%; }
.reveal-card .actions button { flex: 1; padding: 8px 6px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  font: 700 12px system-ui, sans-serif; cursor: pointer; }
.reveal-card .actions button.main-action { background: var(--accent); border-color: var(--accent); color: #1a0f08; }
.reveal-card.shown { border-color: var(--rc); box-shadow: 0 0 22px color-mix(in srgb, var(--rc) 45%, transparent); animation: reveal-flip .45s ease-out; }
.reveal-card.shown .art { background: radial-gradient(circle, color-mix(in srgb, var(--rc) 45%, transparent), transparent 70%); }
.reveal-card.r2.shown .art::before, .reveal-card.r3.shown .art::before { content: ''; position: absolute; inset: -18px; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--rc) 55%, transparent) 0 10deg, transparent 10deg 30deg);
  mask: radial-gradient(circle, #000 30%, transparent 70%); animation: reveal-rays 6s linear infinite; }
.reveal-card.r3.shown { animation: reveal-flip .45s ease-out, reveal-glow 1.6s ease-in-out .45s infinite; }
.reveal-card.kept { outline: 2px solid #4fd16a; outline-offset: 3px; }
.reveal-card.passed { opacity: .35; filter: grayscale(1); }
.reveal-card.kept .actions, .reveal-card.passed .actions { visibility: hidden; }
.reveal-foot { display: flex; gap: 10px; }
.reveal-foot button { padding: 10px 18px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font: 700 14px system-ui, sans-serif; cursor: pointer; }
@keyframes reveal-shiver { from { transform: translate(-1px, 0) rotate(-2deg); } to { transform: translate(1px, -1px) rotate(2deg); } }
@keyframes reveal-pulse { 50% { box-shadow: 0 0 26px rgba(255,255,255,.18); } }
@keyframes reveal-flip { from { transform: rotateY(90deg) scale(.9); } 60% { transform: rotateY(0) scale(1.06); } }
@keyframes reveal-rays { to { transform: rotate(360deg); } }
@keyframes reveal-glow { 50% { box-shadow: 0 0 40px color-mix(in srgb, var(--rc) 75%, transparent); } }
@media (max-width: 520px) { .reveal-card { width: 160px; min-height: 240px; } .reveal h2 { font-size: 18px; } }
