/* Grand Fantasia identity: design tokens, buttons, inputs, boot screen, toasts and the shared tooltip.
   Palette: deep brown #3b2412, bronze #a8743a, gold #f1c04a, cream parchment #eadfc4 + saturated HP red / MP blue / XP green.
   HUD plates are dark wood with a gold bevel (readable over a bright 3D scene); windows and panels are parchment (windows.css, panels.css). */
:root {
  --bg: #0b0806;
  --panel: rgba(36, 22, 11, 0.9);
  --panel-solid: #2a190c;
  --line: rgba(241, 192, 74, 0.35);
  --text: #fff6dc;
  --muted: #cdb98d;
  --gold: #f1c04a;
  --gold-hi: #ffe9a0;
  --gold-lo: #9a6a1c;
  --bronze: #a8743a;
  --bronze-hi: #d9a964;
  --wood: #3b2412;
  --wood-dark: #1e1008;
  --paper: #eadfc4;
  --paper-dark: #d3c19b;
  --ink: #4a2f14;
  --blue: #3b82f6;
  --red: #ef4444;
  --green: #4ade80;
  --hp: #e5484d;
  --mp: #3b82f6;
  --xp: #4bbf3a;
  --radius: 10px;
  --outline: -1px -1px 0 #1a0d04, 1px -1px 0 #1a0d04, -1px 1px 0 #1a0d04, 1px 1px 0 #1a0d04, 0 2px 3px rgba(0, 0, 0, 0.65);
  /* double bevel: dark outline, bronze body, light inner highlight (reused by every plate) */
  --bevel: 0 0 0 2px var(--wood-dark), inset 0 0 0 1px var(--bronze-hi), inset 0 0 0 3px var(--wood), inset 0 0 0 4px rgba(255, 233, 160, 0.55);
  --drop: 0 6px 16px rgba(0, 0, 0, 0.5);
  font-family: "Trebuchet MS", "Segoe UI", "Arial Rounded MT Bold", "Nunito", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); user-select: none; -webkit-user-select: none; }
#game { position: fixed; inset: 0; }
#game canvas { display: block; }
#ui { position: fixed; inset: 0; pointer-events: none; }
#ui .screen, #ui .panel, #ui .interactive { pointer-events: auto; }
#ui #hud, #ui .overlays, #ui .overlays > * { pointer-events: none; }
#ui #hud .frame, #ui #hud .teamframes, #ui #hud .panel { pointer-events: auto; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
.mute { color: var(--muted); }
input, select { font: inherit; color: var(--ink); background: #f6efdc; border: 2px solid #8a6636; border-radius: 8px; padding: 8px 10px; outline: none; box-shadow: inset 0 2px 4px rgba(74, 47, 20, 0.25); }
input:focus, select:focus { border-color: var(--gold-lo); box-shadow: inset 0 2px 4px rgba(74, 47, 20, 0.25), 0 0 0 2px rgba(241, 192, 74, 0.55); }
/* Buttons: parchment pill with a bronze rim; primary = gold; danger = ruby. */
.btn { color: var(--ink); font-weight: 700; background: linear-gradient(#f4e6bf, #cdb27a 55%, #b99a5e); border: 2px solid #5b3a18; border-radius: 16px; padding: 7px 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75), inset 0 -2px 0 rgba(91, 58, 24, 0.3), 0 2px 4px rgba(0, 0, 0, 0.4); transition: transform 0.08s, filter 0.12s; }
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); filter: brightness(0.95); }
.btn.primary { background: linear-gradient(#ffe9a0, #f1c04a 50%, #c98a1c); color: #3a2208; border-color: #5b3a18; text-shadow: 0 1px 0 rgba(255, 244, 200, 0.6); }
.btn.danger { background: linear-gradient(#f08a82, #c2343a 55%, #8c1f26); color: #fff3e0; border-color: #4a0f12; text-shadow: 0 1px 2px #4a0f12; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; filter: grayscale(0.4); }
#boot { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 50% 40%, #5a3a1c, #1a0f07 70%); z-index: 50; }
.boot-card { text-align: center; width: min(420px, 80vw); }
.logo { font-size: clamp(26px, 3.2vw, 36px); font-weight: 800; letter-spacing: 1px; margin-bottom: 18px; color: #fff6dc; text-shadow: var(--outline), 0 0 18px rgba(241, 192, 74, 0.45); }
.logo b { color: var(--gold); }
.boot-bar { height: 12px; padding: 2px; background: #1e1008; border: 2px solid var(--bronze); border-radius: 8px; box-shadow: inset 0 1px 3px #000; }
.boot-bar i { display: block; height: 100%; width: 0; background: linear-gradient(#fff3b8, #f1c04a 50%, #a2701a); border-radius: 4px; transition: width 0.15s; }
#boot-text { margin-top: 10px; color: var(--muted); font-size: 13px; }
#toasts { position: absolute; left: 50%; top: 14%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; width: max-content; max-width: 92vw; }
.toast { position: relative; background: linear-gradient(rgba(70, 46, 24, 0.94), rgba(34, 21, 10, 0.94)); color: #fff6dc; padding: 7px 20px; border-radius: 6px; font-size: 14px; font-weight: 700; text-shadow: var(--outline);
  box-shadow: var(--bevel), var(--drop); animation: toastIn 0.2s ease-out; }
.toast.warn { color: #ffd98a; box-shadow: var(--bevel), 0 0 14px rgba(245, 158, 11, 0.4), var(--drop); }
.toast.bad { color: #ffb4ae; box-shadow: var(--bevel), 0 0 14px rgba(239, 68, 68, 0.45), var(--drop); }
.toast.good { color: #c9f7b8; }
/* a refused action ("Fire Arrow : Cible invalide"): plain red text, no box, readable on any ground by its dark outline */
.toast.reject { background: none; box-shadow: none; border-radius: 0; padding: 1px 8px; color: #ff4a3d; font-size: 15px; text-shadow: -1px -1px 0 #2a0600, 1px -1px 0 #2a0600, -1px 1px 0 #2a0600, 1px 1px 0 #2a0600, 0 2px 4px rgba(0, 0, 0, 0.8); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
/* Tooltip: translucent dark parchment with a cream rim, orange-gold title, white values (Screenchots weapons / skills). */
#tooltip { position: fixed; z-index: 2147483000; /* always above every window, whatever the focus order (GfWindow raises its z-index inline) */  max-width: min(340px, 90vw); background: linear-gradient(rgba(74, 58, 38, 0.95), rgba(40, 29, 17, 0.96)); color: #fff6dc; border-radius: 6px; padding: 10px 13px; font-size: 13px; line-height: 1.4; pointer-events: none;
  box-shadow: 0 0 0 2px var(--wood-dark), inset 0 0 0 1px #e6d3a2, inset 0 0 0 2px #6b4421, var(--drop); }
#tooltip h4, .link-card h4 { margin: 0 0 4px; font-size: 15px; color: #ffa73a; text-shadow: 0 1px 2px #000; }
#tooltip .sk-dot, .link-card .sk-dot { display: inline-block; width: 9px; height: 9px; margin-right: 7px; transform: rotate(45deg); border: 1px solid #1e1008; box-shadow: 0 0 5px currentColor; vertical-align: 1px; }
#tooltip .row, .link-card .row { display: flex; justify-content: space-between; gap: 14px; color: #d8c9a4; }
#tooltip .row span:last-child, .link-card .row span:last-child { color: #fff; text-align: right; }
#tooltip .row.on span, .link-card .row.on span { color: #9ae67a; }
#tooltip .row.bad span, .link-card .row.bad span { color: #ff6b61; font-weight: 600; }
#tooltip .row span.fort-bonus, .link-card .row span.fort-bonus, .ms-info .row span.fort-bonus { color: #7be07b; font-weight: 600; } /* the fortification gain after the original number: "120 (+36)" */
#tooltip h4.setname, .link-card h4.setname { color: #7ee9d6; font-size: 13px; margin-top: 8px; }
#tooltip p, .link-card p { margin: 6px 0 0; color: #f1e7cc; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: rgba(74, 47, 20, 0.15); border-radius: 5px; }
::-webkit-scrollbar-thumb { background: linear-gradient(90deg, #d9a964, #a8743a); border: 1px solid #5b3a18; border-radius: 5px; }
