:root {
  --ink: #f4f1ea;
  --muted: #b9b4a8;
  --panel: rgba(14, 22, 26, 0.62);
  --panel-solid: #121b20;
  --line: rgba(255, 255, 255, 0.14);
  --accent: #e8b44a;
  --hp: #e0574a;
  --str: #e8b44a;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0c1418; color: var(--ink); font-family: "Avenir Next", "Segoe UI", system-ui, sans-serif; }
canvas#game { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
.hidden { display: none !important; }
button { font: inherit; color: var(--ink); background: rgba(255,255,255,0.08); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; cursor: pointer; }
button:hover { background: rgba(255,255,255,0.16); }
button.on { background: var(--accent); color: #1a1408; border-color: var(--accent); }
button.locked { opacity: 0.4; cursor: not-allowed; }
button.primary { background: var(--accent); color: #1a1408; border: none; font-weight: 700; padding: 10px 22px; font-size: 17px; }
button.ghost { background: transparent; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; backdrop-filter: blur(6px); }

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; }
#bars { position: absolute; left: 16px; top: 16px; padding: 10px 12px; width: 330px; }
.bar-row { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.bar-label { width: 66px; font-size: 13px; color: var(--muted); }
.bar { position: relative; flex: 1; height: 16px; background: rgba(0,0,0,0.45); border-radius: 8px; overflow: hidden; }
.bar.small { height: 9px; }
.fill { height: 100%; width: 50%; border-radius: 8px; transition: width 0.2s; }
.fill.hp { background: linear-gradient(90deg, #b8392f, var(--hp)); }
.fill.str { background: linear-gradient(90deg, #b9832a, var(--str)); }
#str-marker { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; opacity: 0.85; }
.bar-text { position: absolute; left: 8px; top: 0; font-size: 11px; line-height: 16px; color: #fff; text-shadow: 0 1px 2px #000; }
#season-box { position: absolute; right: 16px; top: 16px; padding: 10px 14px; min-width: 200px; text-align: right; }
#season-name { font-size: 20px; font-weight: 700; }
#season-name[data-season="Winter"] { color: #cfe8ff; }
#season-name[data-season="Summer"] { color: #ffd77a; }
#season-name[data-season="Autumn"] { color: #f0a060; }
#season-name[data-season="Spring"] { color: #a8e08a; }
.season-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
#leader-badge { color: var(--accent); font-weight: 700; }
#mute-btn { position: absolute; right: 16px; top: 112px; pointer-events: auto; font-size: 13px; padding: 6px 12px; }
#map-box { position: absolute; right: 16px; bottom: 16px; padding: 6px; }
#minimap { display: block; border-radius: 8px; }
#where { font-size: 12px; text-align: center; margin-top: 4px; }
#toasts { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; width: min(560px, 60vw); }
.toast { background: var(--panel-solid); border: 1px solid var(--line); padding: 8px 14px; border-radius: 10px; font-size: 14px; transition: opacity 0.8s; text-align: center; }
.toast.warn { border-color: #e0574a; }
.toast.good { border-color: #7fcf6a; }
.toast.big { font-size: 20px; border-color: var(--accent); padding: 12px 20px; }
.toast.out { opacity: 0; }
#hint { position: absolute; left: 16px; bottom: 16px; font-size: 13px; color: #e8e4da; text-shadow: 0 1px 3px #000; max-width: 520px; }
#crosshair-tip { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); font-size: 12px; color: rgba(255,255,255,0.6); }
#float-layer { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.float-text { position: absolute; left: 0; top: 0; font-weight: 800; font-size: 16px; text-shadow: 0 1px 3px #000, 0 0 2px #000; white-space: nowrap; }
.duck-bar { position: absolute; left: 0; top: 0; text-align: center; }
.duck-name { font-size: 11px; font-weight: 700; text-shadow: 0 1px 2px #000; white-space: nowrap; }
.duck-hp { width: 70px; height: 6px; background: rgba(0,0,0,0.6); border-radius: 3px; overflow: hidden; margin: 2px auto 0; }
.duck-hp-fill { height: 100%; background: #e0574a; }
#fade { position: fixed; inset: 0; background: #05080a; opacity: 0; pointer-events: none; transition: opacity 0.8s; display: flex; align-items: center; justify-content: center; }
#fade.on { opacity: 1; }
#fade-text { font-size: 22px; color: #e8e4da; max-width: 520px; text-align: center; }

/* Start screen */
#start { position: fixed; inset: 0; display: flex; gap: 24px; padding: 28px 32px; background: linear-gradient(90deg, rgba(8,14,18,0.92) 0%, rgba(8,14,18,0.75) 45%, rgba(8,14,18,0.55) 100%); overflow: auto; }
.start-col.left { width: 420px; flex-shrink: 0; }
.start-col.right { flex: 1; min-width: 560px; max-width: 760px; }
h1 { font-family: Georgia, "Times New Roman", serif; font-size: 46px; margin: 0 0 6px; letter-spacing: 0.5px; line-height: 1; }
h1 span { display: block; font-size: 26px; color: var(--accent); font-style: italic; margin-top: 6px; }
.lede { color: #d9d4c8; line-height: 1.45; font-size: 15px; }
h3 { margin: 18px 0 8px; font-size: 15px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); }
#clan-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.clan-card { text-align: left; padding: 10px; border-left: 5px solid; }
.clan-card b { display: block; font-size: 15px; }
.clan-card small { color: var(--muted); }
.clan-card.on { background: rgba(255,255,255,0.18); color: var(--ink); border-color: var(--line); }
.start-buttons { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
#save-info { font-size: 13px; color: var(--muted); margin-top: 8px; }
#controls { border-collapse: collapse; font-size: 13px; width: 100%; }
#controls td { padding: 3px 6px; border-bottom: 1px solid var(--line); }
#controls td:first-child { font-weight: 700; white-space: nowrap; color: var(--accent); width: 130px; }

/* Designer */
#designer-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px; }
#designer-panel h3 { margin-top: 0; }
.designer-grid { display: flex; gap: 16px; }
.preview-wrap { flex: 1; min-width: 300px; }
#preview { width: 100%; height: 300px; display: block; border-radius: 10px; background: radial-gradient(circle at 50% 40%, #3d6b78, #142a32); cursor: pointer; }
.preview-tip { font-size: 12px; color: var(--muted); margin: 6px 0; }
.controls-col { width: 230px; }
.row-title { font-size: 13px; color: var(--muted); margin: 10px 0 5px; }
.row-title b { color: var(--ink); }
.choice { display: flex; flex-wrap: wrap; gap: 6px; }
.choice button { font-size: 13px; padding: 5px 9px; }
.choice.flash { outline: 2px solid var(--accent); border-radius: 8px; }
.target-row { display: flex; gap: 6px; }
.target-row button { font-size: 12px; padding: 5px 7px; display: flex; align-items: center; gap: 5px; }
.swatch { width: 14px; height: 14px; border-radius: 50%; border: 1px solid #fff; display: inline-block; }
.wheel-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
#wheel { width: 150px; height: 150px; cursor: crosshair; touch-action: none; }
#lightness { writing-mode: vertical-lr; direction: rtl; height: 150px; width: 20px; }
.designer-foot { display: flex; justify-content: space-between; margin-top: 14px; }

/* Overlays */
.overlay { position: fixed; inset: 0; background: rgba(5,10,12,0.6); display: flex; align-items: center; justify-content: center; }
#nest-designer-slot { width: min(820px, 94vw); max-height: 94vh; overflow: auto; }
.pause-card { background: var(--panel-solid); border: 1px solid var(--line); border-radius: 14px; padding: 26px 34px; text-align: center; }
.pause-card h2 { margin: 0 0 8px; font-family: Georgia, serif; font-size: 34px; }
.small { font-size: 13px; color: var(--muted); }

/* Language switch (start screen and pause menu) */
.lang-switch { display: inline-flex; gap: 4px; margin: 12px 0 2px; }
.lang-switch button { font-size: 13px; padding: 4px 12px; }
.pause-card .lang-switch { display: flex; justify-content: center; margin-top: 14px; }

/* Way back to sophia.games (start screen and pause menu) */
.home-link { display: inline-block; margin-bottom: 10px; font-size: 14px; color: inherit; opacity: 0.75; text-decoration: none; }
.home-link:hover { opacity: 1; text-decoration: underline; }
.pause-card .home-link { display: block; margin: 16px 0 0; }
