:root {
  --ink: #eef5dc;
  --muted: #b8c6a3;
  --green: #b9e551;
  --green-dark: #6fa62f;
  --panel: rgba(17, 24, 15, 0.82);
  --line: rgba(229, 242, 202, 0.18);
  --gold: #ffd66b;
  --danger: #ff6d56;
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #10180f;
  color: var(--ink);
  user-select: none;
}

button { font: inherit; }
input { font: inherit; }

#game-shell, #game {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

#game {
  display: block;
  background: #8fc9d5;
  image-rendering: auto;
}

#vignette, #damage-flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

#vignette { box-shadow: inset 0 0 16vw rgba(8, 13, 7, .44); }
#damage-flash { background: rgba(220, 28, 16, 0); transition: background .12s; }
#damage-flash.show { background: rgba(220, 28, 16, .27); }

.hidden { display: none !important; }
.panel { border: 1px solid var(--line); background: var(--panel); box-shadow: 0 12px 42px rgba(3, 8, 2, .26); backdrop-filter: blur(10px); }
.eyebrow { color: var(--green); font-size: 10px; line-height: 1; font-weight: 900; letter-spacing: .22em; }
.eyebrow.light { color: #dce8ca; }
.eyebrow.gold { color: var(--gold); }
.eyebrow.danger { color: var(--danger); }
.music-toggle { position: fixed; z-index: 41; right: 24px; bottom: 58px; display: flex; align-items: center; gap: 7px; border: 1px solid rgba(235,245,217,.25); padding: 8px 10px; background: rgba(15,22,13,.82); color: #e9f0dd; font-size: 8px; font-weight: 900; letter-spacing: .12em; cursor: pointer; box-shadow: 0 8px 25px rgba(0,0,0,.24); backdrop-filter: blur(8px); }
.music-toggle:hover { border-color: var(--green); background: rgba(32,45,25,.92); }
.music-toggle span { color: var(--green); font-size: 14px; line-height: 1; }
.music-toggle[aria-pressed="false"] { color: #929d89; }
.music-toggle[aria-pressed="false"] span { color: #77816f; }

.top-bar {
  position: fixed;
  left: 26px;
  right: 26px;
  top: 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 5;
  pointer-events: none;
}

.brand-small { display: flex; align-items: center; gap: 10px; font-weight: 1000; letter-spacing: .12em; font-size: 13px; text-shadow: 0 2px 12px #172113; }
.brand-cube { width: 17px; height: 17px; background: var(--green); display: inline-block; box-shadow: inset -5px -5px 0 #6fa62f, 0 0 15px rgba(185,229,81,.25); transform: rotate(45deg); }
.world-status { display: flex; align-items: center; gap: 8px; color: rgba(248,252,239,.86); font-weight: 800; font-size: 10px; letter-spacing: .15em; text-shadow: 0 2px 7px #1c2817; }
#fps-counter { padding-left: 9px; border-left: 1px solid rgba(238,246,222,.28); color: var(--green); min-width: 52px; }
#day-dot { width: 7px; height: 7px; border-radius: 50%; background: #ffd675; box-shadow: 0 0 10px #ffca59; }
.lan-status-button { pointer-events: auto; display: flex; align-items: center; gap: 7px; border: 1px solid rgba(238,246,222,.2); padding: 7px 10px; background: rgba(15,22,13,.72); color: #dbe5cc; font-size: 8px; font-weight: 900; letter-spacing: .14em; cursor: pointer; backdrop-filter: blur(8px); }
.lan-status-button:hover { border-color: rgba(185,229,81,.6); }
.lan-status-button i, .lan-modal-dot { width: 7px; height: 7px; border-radius: 50%; background: #87917d; box-shadow: 0 0 8px rgba(135,145,125,.3); }
.lan-status-button[data-status="connected"] i, .lan-modal-dot[data-status="connected"] { background: var(--green); box-shadow: 0 0 9px rgba(185,229,81,.7); }
.lan-status-button[data-status="connecting"] i, .lan-status-button[data-status="reconnecting"] i, .lan-modal-dot[data-status="connecting"], .lan-modal-dot[data-status="reconnecting"] { background: var(--gold); box-shadow: 0 0 9px rgba(255,214,107,.65); animation: lan-pulse 1s infinite alternate; }
.lan-status-button[data-status="error"] i, .lan-modal-dot[data-status="error"] { background: var(--danger); box-shadow: 0 0 9px rgba(255,109,86,.65); }
@keyframes lan-pulse { to { opacity: .35; } }

.quest-card { position: fixed; z-index: 5; top: 68px; left: 24px; width: 268px; padding: 18px 18px 15px; }
.quest-card h2 { font-family: Georgia, serif; font-size: 21px; margin: 7px 0 13px; letter-spacing: -.03em; }
.quest-card ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.quest-card li { display: flex; align-items: center; gap: 10px; color: #d1dac1; font-size: 12px; transition: opacity .25s, color .25s; }
.quest-card li.done { color: #8b987d; text-decoration: line-through; opacity: .72; }
.quest-check { flex: 0 0 20px; height: 20px; display: grid; place-items: center; border: 1px solid rgba(230,242,207,.32); color: #dce7cc; font-size: 9px; font-weight: 800; }
.done .quest-check { background: var(--green); color: #20310c; border-color: var(--green); text-decoration: none; }
.done .quest-check::after { content: "✓"; font-size: 11px; }
.done .quest-check { font-size: 0; }
#kill-count { color: var(--green); margin-left: 4px; }
.quest-card li.endless { margin-top: 3px; padding-top: 8px; border-top: 1px solid var(--line); color: #e7f0d8; }
.quest-card li.endless .quest-check { color: var(--green); border-color: rgba(185,229,81,.5); }

.stats-card { position: fixed; z-index: 5; top: 68px; right: 24px; width: 284px; padding: 14px; }
.stat-row { display: flex; justify-content: space-between; font-size: 9px; letter-spacing: .13em; font-weight: 900; color: var(--muted); }
.stat-row b { color: white; }
.bar { height: 6px; margin: 8px 0 15px; background: rgba(255,255,255,.12); overflow: hidden; }
.bar i { display: block; width: 100%; height: 100%; background: linear-gradient(90deg, #d34c38, #ff785d); transition: width .2s; }
.hunger-row { color: #d7b46b; }
.hunger-bar i { background: linear-gradient(90deg, #e38b37, #ffc15d); }
.armor-row { color: #9fd9e5; }
.armor-bar i { width: 0; background: linear-gradient(90deg, #80969c, #70dce8); }
#armor-text.ghost { color: #ffd45a; text-shadow: 0 0 8px rgba(255,201,58,.55); }
.armor-bar i.ghost { animation: ghost-armor-shimmer 1.8s ease-in-out infinite alternate; }
@keyframes ghost-armor-shimmer { from { opacity: .55; } to { opacity: 1; } }
.shield-row { margin: -5px 0 12px; color: #d5bf93; align-items: center; }
.shield-row kbd { margin-left: 3px; }
.shield-row b.active { color: var(--green); }
.inventory-mini { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.inventory-mini > div { min-width: 0; height: 58px; background: rgba(255,255,255,.055); display: grid; grid-template: 27px 12px / 29px 1fr; align-items: center; padding: 5px 5px 4px; }
.inventory-mini > div.empty { display: none; }
.inventory-mini b { font-size: 15px; }
.inventory-mini small { grid-column: 1 / 3; font-size: 7px; letter-spacing: .08em; color: #aeba9d; }
.lan-hud-card { position: fixed; z-index: 5; top: 330px; right: 24px; width: 284px; padding: 13px; }
.lan-hud-player-list { margin-top: 10px; display: grid; gap: 6px; }
.lan-hud-player { display: flex; align-items: center; gap: 8px; color: #d9e2cd; font-size: 9px; font-weight: 800; letter-spacing: .05em; }
.lan-hud-player i, .lan-player-row i { width: 8px; height: 8px; flex: 0 0 8px; background: var(--player-color, var(--green)); transform: rotate(45deg); }
.lan-hud-player b { margin-left: auto; color: #94a187; font-size: 7px; letter-spacing: .12em; }

.mini-map { position: fixed; z-index: 7; left: 24px; bottom: 24px; width: 212px; padding: 10px; color: var(--ink); text-align: left; cursor: pointer; pointer-events: auto; }
.mini-map:hover { border-color: rgba(185,229,81,.62); box-shadow: 0 12px 42px rgba(3,8,2,.36), 0 0 0 2px rgba(185,229,81,.08); }
.mini-map-header, .mini-map-coordinates { display: flex; align-items: center; justify-content: space-between; }
.mini-map-header { min-height: 20px; margin-bottom: 7px; color: var(--green); font-size: 8px; letter-spacing: .18em; }
.mini-map-header kbd { color: white; letter-spacing: 0; }
.mini-map canvas { display: block; width: 190px; height: 190px; border: 1px solid rgba(232,244,211,.24); background: #172019; image-rendering: pixelated; }
.mini-map-coordinates { flex-direction: column; align-items: stretch; gap: 4px; min-height: 19px; padding-top: 7px; color: #abb8a0; font: 800 8px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .1em; }
.mini-map-place, .mini-map-position { display: flex; justify-content: space-between; gap: 6px; }
.mini-map-position { color: #cfe0c2; }

.chat-panel { position: fixed; z-index: 9; left: 50%; bottom: 105px; width: min(520px, calc(100vw - 500px)); min-width: 360px; padding: 12px; transform: translateX(-50%); color: var(--ink); pointer-events: auto; }
.chat-panel.active { border-color: rgba(185,229,81,.52); box-shadow: 0 15px 55px rgba(3,8,2,.48), 0 0 0 2px rgba(185,229,81,.08); }
.chat-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.chat-header div { display: grid; gap: 4px; }
.chat-header span { color: var(--green); font-size: 9px; font-weight: 950; letter-spacing: .2em; }
.chat-header small { color: #8f9c84; font-size: 7px; font-weight: 850; letter-spacing: .12em; }
.chat-header button { width: 25px; height: 25px; border: 0; background: rgba(255,255,255,.08); color: white; cursor: pointer; font-size: 17px; line-height: 1; }
.chat-messages { display: grid; gap: 6px; max-height: 130px; margin-top: 10px; overflow: auto; }
.chat-empty { margin: 4px 0; color: #7f8d75; font-size: 9px; }
.chat-message { display: grid; grid-template-columns: 8px minmax(0,1fr) auto; gap: 3px 8px; align-items: center; padding: 7px 8px; background: rgba(255,255,255,.045); }
.chat-message > i { grid-row: 1 / 3; width: 7px; height: 7px; background: var(--player-color, var(--green)); transform: rotate(45deg); }
.chat-message b { overflow: hidden; color: var(--player-color, var(--green)); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.chat-message time { color: #718069; font: 700 7px ui-monospace, SFMono-Regular, Menlo, monospace; }
.chat-message p { grid-column: 2 / 4; margin: 0; color: #edf3e7; font-size: 11px; line-height: 1.4; overflow-wrap: anywhere; user-select: text; }
.chat-message.own { background: rgba(185,229,81,.075); }
.chat-message.sending { opacity: .72; }
.chat-message.failed { border-left: 2px solid var(--danger); opacity: .78; }
.chat-message.failed time { color: var(--danger); }
.chat-form { display: grid; gap: 7px; margin-top: 11px; padding-top: 10px; border-top: 1px solid var(--line); }
.chat-form label { color: #cbd7be; font-size: 8px; font-weight: 900; letter-spacing: .15em; }
.chat-input-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 7px; }
.chat-input-row input { min-width: 0; width: 100%; border: 1px solid rgba(236,246,218,.28); outline: none; padding: 10px 11px; background: rgba(5,10,4,.72); color: white; font-size: 12px; user-select: text; }
.chat-input-row input:focus { border-color: var(--green); box-shadow: 0 0 0 2px rgba(185,229,81,.1); }
.chat-input-row button { border: 0; padding: 0 14px; background: var(--green); color: #17200e; font-size: 9px; font-weight: 950; letter-spacing: .1em; cursor: pointer; }
.chat-form > small { color: #84917a; font-size: 8px; line-height: 1.4; }
.chat-panel:not(.active) .chat-form, .chat-panel:not(.active) .chat-header button { display: none; }
.chat-panel:not(.active) .chat-messages { max-height: 82px; }

.item-icon { display: inline-block; width: 21px; height: 21px; position: relative; box-shadow: inset -5px -5px rgba(0,0,0,.16); }
.item-icon.log { background: #795134; border: 3px solid #51341f; border-radius: 45%; }
.item-icon.plank { background: repeating-linear-gradient(0deg, #d59d52 0 5px, #bc7839 6px 7px); border: 1px solid #754524; }
.item-icon.rock { background: #8b9085; clip-path: polygon(14% 25%, 60% 5%, 95% 34%, 84% 84%, 34% 97%, 3% 67%); }
.item-icon.coal { background: #30342f; clip-path: polygon(14% 25%, 60% 5%, 95% 34%, 84% 84%, 34% 97%, 3% 67%); }
.item-icon.iron-ore { background: #b18468; border: 4px dotted #d9ad8d; box-shadow: inset -4px -4px rgba(0,0,0,.16); }
.item-icon.iron { background: linear-gradient(145deg, #f0eee7, #979d9c); clip-path: polygon(12% 26%, 24% 10%, 86% 10%, 96% 35%, 83% 88%, 16% 88%, 4% 61%); }
.item-icon.gold-ore { background: #9b8050; border: 4px dotted #edc54f; box-shadow: inset -4px -4px rgba(0,0,0,.16); }
.item-icon.gold { background: linear-gradient(145deg, #ffe97a, #c88b13); clip-path: polygon(12% 26%, 24% 10%, 86% 10%, 96% 35%, 83% 88%, 16% 88%, 4% 61%); }
.item-icon.sand { background: repeating-linear-gradient(135deg, #dfca8c 0 3px, #cbb473 3px 5px); border: 1px solid #a58e52; }
.item-icon.glass { background: rgba(169,222,231,.32); border: 2px solid #a9dee7; box-shadow: inset -5px -5px rgba(80,151,164,.15); }
.item-icon.calcite { background: linear-gradient(145deg, #f1eee3, #aaa89d); clip-path: polygon(14% 25%, 60% 5%, 95% 34%, 84% 84%, 34% 97%, 3% 67%); }
.item-icon.amethyst { background: linear-gradient(145deg, #c884e8, #70409b); clip-path: polygon(50% 0, 96% 29%, 76% 85%, 50% 100%, 24% 85%, 4% 29%); box-shadow: inset -6px -5px rgba(60,25,91,.28); }
.item-icon.cage { background: repeating-linear-gradient(90deg, #a9b3b0 0 2px, transparent 2px 7px), repeating-linear-gradient(0deg, #8d9895 0 2px, rgba(18,26,23,.2) 2px 7px); border: 1px solid #c0c8c5; box-shadow: none; }
.item-icon.diamond { background: #52e2e5; clip-path: polygon(50% 0, 96% 29%, 76% 85%, 50% 100%, 24% 85%, 4% 29%); box-shadow: inset -6px -5px rgba(18,111,137,.28); }
.item-icon.obsidian { background: linear-gradient(135deg, #473378 0 36%, #271b42 37% 68%, #3a285f 69%); clip-path: polygon(14% 25%, 60% 5%, 95% 34%, 84% 84%, 34% 97%, 3% 67%); box-shadow: inset -5px -5px rgba(8,4,19,.46); }
.item-icon.lava { background: radial-gradient(circle at 31% 29%, #ffd45a 0 12%, transparent 14%), linear-gradient(135deg, #ff8b2f, #ba341f); clip-path: polygon(50% 0, 90% 33%, 72% 88%, 50% 100%, 28% 88%, 10% 33%); box-shadow: inset -5px -5px rgba(83,18,13,.3); }
.item-icon.mossy-bricks { background: repeating-linear-gradient(0deg, transparent 0 6px, rgba(30,43,28,.55) 6px 8px), repeating-linear-gradient(90deg, #60715d 0 9px, #394936 9px 11px); border: 1px solid #8a9b7d; }
.item-icon.cracked-bricks { background: linear-gradient(125deg, transparent 0 42%, #242a27 43% 48%, transparent 49%), repeating-linear-gradient(0deg, #747975 0 6px, #424744 6px 8px); border: 1px solid #9b9f9b; }
.item-icon.ruins-crystal { background: linear-gradient(145deg, #dffcff, #68dff4 42%, #3987c3); clip-path: polygon(50% 0, 88% 35%, 68% 100%, 32% 100%, 12% 35%); filter: drop-shadow(0 0 5px #7eefff); box-shadow: none; }
.item-icon.ruins-relic { background: radial-gradient(circle, #f9ffff 0 14%, #85f5ff 16% 34%, #2d7197 36% 60%, #142d40 62%); border: 2px solid #bffaff; transform: rotate(45deg); box-shadow: 0 0 7px #68eaff; }
.item-icon.apple { background: #cf4136; border: 2px solid #8f2d27; border-radius: 48% 48% 52% 52%; }
.item-icon.apple::before { content: ""; position: absolute; width: 4px; height: 7px; left: 8px; top: -5px; background: #6f4b27; }
.item-icon.apple::after { content: ""; position: absolute; width: 8px; height: 5px; left: 11px; top: -3px; border-radius: 70% 10% 70% 10%; background: #72a744; }
.item-icon.berries { background: radial-gradient(circle at 30% 35%, #a56bc7 0 18%, transparent 20%), radial-gradient(circle at 70% 38%, #76409e 0 21%, transparent 23%), radial-gradient(circle at 48% 72%, #8b4caf 0 23%, transparent 25%); box-shadow: none; }
.item-icon.berries::before { content: ""; position: absolute; width: 4px; height: 9px; left: 9px; top: -2px; background: #6c9d42; transform: rotate(18deg); }
.item-icon.raw-meat { background: #cf675c; border-radius: 48% 55% 45% 38%; border: 2px solid #8d3f3a; transform: rotate(-12deg); }
.item-icon.raw-meat::after { content: ""; position: absolute; width: 7px; height: 7px; right: 3px; top: 3px; border-radius: 50%; background: #f3aba0; }
.item-icon.cooked-meat { background: #995637; border-radius: 48% 55% 45% 38%; border: 2px solid #54301f; transform: rotate(-12deg); }
.item-icon.cooked-meat::after { content: ""; position: absolute; width: 8px; height: 3px; right: 2px; top: 5px; background: #d68b4e; }

#crosshair { position: fixed; z-index: 6; left: 50%; top: 50%; width: 22px; height: 22px; transform: translate(-50%,-50%); filter: drop-shadow(0 1px 2px #111); pointer-events: none; }
#crosshair i { position: absolute; background: white; border-radius: 1px; }
#crosshair i:first-child { width: 2px; height: 18px; left: 10px; top: 2px; }
#crosshair i:last-child { width: 18px; height: 2px; top: 10px; left: 2px; }
#crosshair.danger i { background: #ff725e; }
#crosshair.prey i { background: #ffd26b; }
#crosshair.active i { background: var(--green); }

#target-label { position: fixed; z-index: 6; left: 50%; top: calc(50% + 30px); transform: translateX(-50%); padding: 5px 9px; color: white; background: rgba(11,15,9,.66); font-size: 10px; font-weight: 850; letter-spacing: .1em; opacity: 0; transition: opacity .12s; pointer-events: none; }
#target-label.show { opacity: 1; }

#action-progress { position: fixed; z-index: 6; left: 50%; top: 50%; width: 42px; height: 42px; transform: translate(-50%,-50%); border-radius: 50%; background: conic-gradient(var(--green) 0deg, transparent 0); opacity: 0; pointer-events: none; mask: radial-gradient(transparent 56%, black 59%); -webkit-mask: radial-gradient(transparent 56%, black 59%); }
#action-progress.show { opacity: 1; }
.portal-travel { position: fixed; z-index: 45; left: 50%; bottom: 116px; width: min(320px,calc(100vw - 40px)); padding: 12px 14px; transform: translate(-50%,18px); border: 1px solid rgba(132,239,255,.58); background: rgba(7,25,32,.88); color: #dffcff; text-align: center; opacity: 0; pointer-events: none; transition: opacity .18s,transform .18s; box-shadow: 0 0 30px rgba(76,219,246,.18); }
.portal-travel.show { opacity: 1; transform: translate(-50%,0); }
.portal-travel b { display: block; font-size: 10px; letter-spacing: .18em; }
.portal-travel i { display: block; height: 5px; margin: 8px 0 6px; overflow: hidden; background: rgba(143,238,255,.15); }
.portal-travel i span { display: block; width: 0; height: 100%; background: linear-gradient(90deg,#5ad8ff,#d8ffff); box-shadow: 0 0 10px #75edff; }
.portal-travel small { color: #8fbac2; font-size: 7px; letter-spacing: .14em; }

#hurt-direction { position: fixed; z-index: 7; top: 41%; left: 50%; color: var(--danger); font-size: 34px; font-weight: 1000; opacity: 0; transform: translate(-50%, -50%); text-shadow: 0 2px 7px #45150e; transition: opacity .2s; }
#hurt-direction.show { opacity: 1; }

kbd { font-family: inherit; padding: 2px 5px; background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.22); border-bottom-width: 2px; border-radius: 2px; color: white; font-size: .9em; }

#hotbar { position: fixed; z-index: 8; bottom: 22px; left: 50%; transform: translateX(-50%); display: flex; gap: 7px; }
.slot { position: relative; width: 76px; height: 68px; border: 1px solid rgba(244,250,231,.2); background: rgba(16,22,13,.82); color: #eff4e6; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; box-shadow: 0 8px 25px rgba(0,0,0,.25); }
.slot:hover { background: rgba(37,49,28,.92); }
.slot.selected { border: 2px solid var(--green); transform: translateY(-5px); box-shadow: 0 0 0 2px rgba(17,22,13,.8), 0 9px 28px rgba(0,0,0,.32); }
.slot.locked { opacity: .38; }
.slot small { position: absolute; top: 4px; left: 6px; font-size: 8px; color: #b8c5aa; }
.slot b { font-size: 8px; letter-spacing: .07em; text-transform: uppercase; }
.slot em { color: var(--green); font-style: normal; }
.slot > i { position: absolute; bottom: -14px; width: 100%; color: #a9b69a; font-size: 6px; font-style: normal; letter-spacing: .1em; opacity: 0; transition: opacity .15s; }
.slot.selected > i { opacity: 1; }
.slot-icon { height: 31px; font-family: Georgia, serif; font-size: 32px; line-height: 30px; color: #d6bf91; text-shadow: 2px 2px #523e2d; }
.hand-icon { color: #e7c38e; }
.armor-slot .slot-icon { color: #556267; text-shadow: 1px 2px rgba(17,24,20,.8); }
.build-cube { height: 30px; color: #d59d52; font-size: 29px; line-height: 27px; text-shadow: 2px 2px #754524; }
.food-slot .item-icon { width: 28px; height: 24px; }

.screen { position: fixed; z-index: 20; inset: 0; display: none; }
.screen.active { display: flex; }
#start-screen { align-items: center; justify-content: center; overflow: hidden; background: radial-gradient(circle at 72% 26%, rgba(219,246,173,.1), transparent 30%), linear-gradient(110deg, rgba(12,19,10,.68), rgba(15,25,12,.26)); }
#start-screen::before, #start-screen::after { content: ""; position: absolute; width: 25vw; aspect-ratio: 1; border: 1px solid rgba(210,235,172,.11); transform: rotate(45deg); }
#start-screen::before { left: -14vw; top: -5vw; box-shadow: 0 0 0 6vw rgba(180,215,125,.025), 0 0 0 12vw rgba(180,215,125,.025); }
#start-screen::after { right: -14vw; bottom: -8vw; box-shadow: 0 0 0 5vw rgba(180,215,125,.025); }
.title-lockup { position: relative; z-index: 1; text-align: center; transform: translateY(-2vh); text-shadow: 0 4px 28px rgba(0,0,0,.5); }
.title-lockup h1 { margin: 10px 0 4px; font-size: clamp(58px, 9vw, 128px); line-height: .84; letter-spacing: -.075em; font-weight: 1000; }
.title-lockup h1 span { color: var(--green); }
.title-lockup p { font-family: Georgia, serif; font-size: clamp(17px, 2vw, 23px); line-height: 1.45; color: #d8e2c8; margin: 24px 0 28px; }
.primary-button { border: 0; padding: 14px 18px 14px 20px; background: var(--green); color: #17200e; font-weight: 1000; letter-spacing: .11em; font-size: 11px; cursor: pointer; box-shadow: 0 10px 30px rgba(81,128,25,.28); }
.primary-button:hover { background: #d0f47a; transform: translateY(-1px); }
.primary-button:disabled { opacity: .38; cursor: not-allowed; transform: none; }
.primary-button span { display: inline-block; margin-left: 20px; font-size: 17px; vertical-align: -1px; }
.secondary-button { border: 1px solid rgba(235,245,217,.25); padding: 13px 17px; background: rgba(23,32,19,.76); color: #e9f0dd; font-weight: 900; letter-spacing: .1em; font-size: 10px; cursor: pointer; }
.secondary-button:hover { border-color: var(--green); background: rgba(185,229,81,.08); transform: translateY(-1px); }
.secondary-button:disabled { opacity: .38; cursor: not-allowed; transform: none; }
.start-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.start-actions .primary-button { min-width: 185px; }
.start-actions .secondary-button { min-width: 128px; }
.modal-secondary { margin: 9px auto 0; }
.start-tip { margin-top: 26px; font-size: 10px; color: #b7c3a9; }
.start-footer { position: absolute; left: 28px; right: 28px; bottom: 24px; display: flex; justify-content: space-between; color: rgba(229,240,211,.56); font-size: 9px; letter-spacing: .2em; font-weight: 800; }

.modal-screen { align-items: center; justify-content: center; background: rgba(6,10,5,.62); backdrop-filter: blur(7px); }
.dark-panel { background: rgba(20,28,17,.94); }
.modal { width: min(430px, calc(100vw - 30px)); padding: 38px; text-align: center; }
.modal h2 { font: 700 36px/1.08 Georgia, serif; margin: 12px 0 10px; letter-spacing: -.03em; }
.modal p { color: #b7c2a9; font-size: 13px; line-height: 1.55; margin: 0 auto 24px; max-width: 340px; }
.text-button { display: block; margin: 16px auto 0; border: 0; background: none; color: #aab69d; font-size: 10px; text-transform: uppercase; text-decoration: underline; cursor: pointer; letter-spacing: .1em; }

.lan-window { width: min(840px, calc(100vw - 30px)); max-height: min(760px, calc(100vh - 30px)); padding: 27px; overflow: auto; }
.lan-window > header { display: flex; align-items: flex-start; justify-content: space-between; padding-bottom: 17px; border-bottom: 1px solid var(--line); }
.lan-window h2 { margin: 7px 0 0; font: 700 29px Georgia, serif; letter-spacing: -.025em; }
.modal-close { border: 0; background: rgba(255,255,255,.08); color: white; width: 34px; height: 34px; font-size: 22px; cursor: pointer; }
.map-window { width: min(1040px, calc(100vw - 30px)); max-height: calc(100vh - 30px); padding: 24px; overflow: auto; }
.map-window > header { display: flex; align-items: flex-start; justify-content: space-between; padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.map-window h2 { margin: 6px 0 0; font: 700 29px Georgia, serif; letter-spacing: -.025em; }
.world-map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 18px; margin-top: 18px; }
.world-map-frame { display: grid; place-items: center; min-width: 0; }
.world-map-frame canvas { display: block; width: min(100%, calc(100vh - 190px)); max-width: 720px; aspect-ratio: 1; border: 1px solid rgba(230,243,207,.22); background: #121a13; image-rendering: pixelated; }
.map-roster { min-width: 0; padding: 15px; border: 1px solid var(--line); background: rgba(255,255,255,.03); }
.map-player-list { display: grid; gap: 7px; margin-top: 12px; }
.map-player-entry { display: grid; grid-template-columns: 10px minmax(0,1fr); gap: 3px 9px; align-items: center; padding: 8px; background: rgba(255,255,255,.045); }
.map-player-entry i { grid-row: 1 / 3; width: 9px; height: 9px; background: var(--player-color, var(--green)); transform: rotate(45deg); box-shadow: 0 0 8px color-mix(in srgb, var(--player-color, var(--green)) 55%, transparent); }
.map-player-entry b { overflow: hidden; color: #edf4e4; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.map-player-entry small { color: #929f87; font: 700 8px ui-monospace, SFMono-Regular, Menlo, monospace; }
.map-roster > p { margin: 14px 0 0; color: #8e9b83; font-size: 9px; line-height: 1.55; }
.map-window > footer { padding-top: 14px; color: #9eaa92; text-align: center; font-size: 9px; }
.lan-status-row { display: flex; align-items: center; gap: 11px; padding: 13px 14px; margin: 16px 0; border: 1px solid var(--line); background: rgba(255,255,255,.035); }
.lan-status-row .lan-modal-dot { flex: 0 0 9px; width: 9px; height: 9px; }
.lan-status-row div { display: grid; gap: 3px; }
.lan-status-row small { color: #8f9c84; font-size: 7px; font-weight: 900; letter-spacing: .15em; }
.lan-status-row b { color: #edf4e4; font-size: 11px; }
.lan-layout { display: grid; grid-template-columns: 1.08fr .92fr; gap: 18px; }
.lan-form { display: grid; gap: 12px; padding: 17px; border: 1px solid var(--line); background: rgba(255,255,255,.035); }
.lan-form label { display: grid; gap: 6px; }
.lan-form label > span { color: #aab69e; font-size: 8px; font-weight: 900; letter-spacing: .14em; }
.lan-form input { min-width: 0; width: 100%; border: 1px solid rgba(236,246,218,.2); outline: none; padding: 11px 12px; background: rgba(5,10,4,.48); color: white; font-size: 13px; user-select: text; }
.lan-form input:focus { border-color: var(--green); box-shadow: 0 0 0 2px rgba(185,229,81,.1); }
.lan-address-fields { display: grid; grid-template-columns: 1fr 88px; gap: 9px; }
.lan-field-help { margin: -1px 0 1px; color: #96a38b; font-size: 9px; line-height: 1.5; }
.lan-buttons { display: flex; gap: 8px; }
.lan-buttons > button { flex: 1; }
.lan-buttons .primary-button span { margin-left: 7px; }
.data-multiplayer-fields { display: grid; gap: 10px; margin-top: 4px; padding-top: 14px; border-top: 1px solid var(--line); }
.data-multiplayer-fields .lan-buttons { flex-wrap: wrap; }
.data-multiplayer-fields .lan-buttons > button { min-width: 145px; }
.danger-button { border: 1px solid rgba(255,109,86,.45); padding: 11px 14px; background: rgba(123,40,31,.18); color: #ff8d79; font-weight: 900; letter-spacing: .1em; font-size: 9px; cursor: pointer; }
.danger-button:hover { background: rgba(158,45,35,.3); }
.lan-info { display: grid; gap: 10px; }
.lan-info section { padding: 15px; border: 1px solid var(--line); background: rgba(255,255,255,.03); }
.lan-server-list, .lan-player-list { display: grid; gap: 6px; margin-top: 10px; }
.lan-server-list p, .lan-player-list p { margin: 0; color: #9ba790; font-size: 9px; line-height: 1.45; }
.lan-server-address { display: block; width: 100%; border: 0; padding: 8px 9px; background: rgba(185,229,81,.08); color: #dcedbc; text-align: left; font: 800 10px ui-monospace, SFMono-Regular, Menlo, monospace; cursor: pointer; user-select: text; }
.lan-server-address:hover { background: rgba(185,229,81,.15); }
.discovery-note { display: block; margin-top: 9px; color: #76836c; font-size: 8px; line-height: 1.45; }
.lan-player-row { display: flex; align-items: center; gap: 8px; min-height: 31px; padding: 6px 8px; background: rgba(255,255,255,.045); color: #dde5d2; font-size: 10px; }
.lan-player-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lan-player-row b { margin-left: auto; color: var(--green); font-size: 7px; letter-spacing: .12em; }
.lan-log-wrap { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.lan-log-wrap summary { color: #89967e; cursor: pointer; font-size: 8px; font-weight: 900; letter-spacing: .15em; }
.lan-log { max-height: 92px; margin: 9px 0 0; padding: 9px 9px 9px 27px; overflow: auto; background: rgba(4,8,3,.4); color: #9fac94; font: 9px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; user-select: text; }
.lan-log li.error { color: #ff8f7d; }
.lan-log li.warn { color: #e5c46f; }

.craft-window { width: min(720px, calc(100vw - 30px)); max-height: min(680px, calc(100vh - 30px)); padding: 27px; overflow: auto; }
.craft-window header { display: flex; align-items: flex-start; justify-content: space-between; border-bottom: 1px solid var(--line); padding-bottom: 18px; }
.craft-window h2 { font: 700 29px Georgia, serif; margin: 7px 0 0; }
#close-craft { border: 0; background: rgba(255,255,255,.08); color: white; width: 34px; height: 34px; font-size: 22px; cursor: pointer; }
.craft-inventory { display: flex; flex-wrap: wrap; gap: 7px 18px; margin: 16px 0; color: #d7dfcc; font-size: 11px; font-weight: 800; }
.craft-inventory span { color: var(--green); margin-left: 4px; }
.recipe-list { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.recipe { min-height: 105px; border: 1px solid rgba(240,247,225,.13); background: rgba(255,255,255,.045); color: white; padding: 14px; display: grid; grid-template-columns: 50px 1fr auto; text-align: left; gap: 12px; align-items: center; cursor: pointer; }
.recipe:hover:not(:disabled) { border-color: var(--green); background: rgba(184,228,80,.08); }
.recipe:disabled { cursor: default; opacity: .43; }
.recipe-icon { width: 46px; height: 46px; display: grid; place-items: center; background: rgba(255,255,255,.07); font: 36px Georgia, serif; color: #dabf8e; }
.recipe-info b { display: block; font: 700 17px Georgia, serif; margin-bottom: 5px; }
.recipe-info small { display: block; color: #aeba9f; font-size: 9px; line-height: 1.5; letter-spacing: .03em; }
.recipe-action { color: var(--green); font-size: 10px; font-weight: 900; letter-spacing: .08em; }
.craft-window footer { padding-top: 18px; color: #98a58c; text-align: center; font-size: 10px; }

.furnace-window { width: min(560px, calc(100vw - 30px)); padding: 28px; text-align: center; }
.furnace-window header { display: flex; align-items: flex-start; justify-content: space-between; padding-bottom: 18px; border-bottom: 1px solid var(--line); text-align: left; }
.furnace-window h2 { margin: 7px 0 0; font: 700 29px Georgia, serif; }
.furnace-window header button { border: 0; background: rgba(255,255,255,.08); color: white; width: 34px; height: 34px; font-size: 22px; cursor: pointer; }
.eyebrow.flame { color: #ff9a4a; }
.smelter { display: grid; grid-template-columns: 1fr 105px 1fr; gap: 14px; align-items: center; margin: 28px 0 18px; }
.smelt-item { min-height: 116px; display: grid; place-items: center; align-content: center; gap: 7px; background: rgba(255,255,255,.05); border: 1px solid var(--line); }
.smelt-item .item-icon { width: 34px; height: 34px; }
.smelt-item b { font-size: 9px; letter-spacing: .1em; color: #c5ceba; }
.smelt-item strong { font: 700 23px Georgia, serif; }
.smelt-item.output { border-color: rgba(185,229,81,.3); }
.smelt-arrow span { display: block; color: #ff8d3e; font-size: 31px; text-shadow: 0 0 17px rgba(255,106,36,.6); }
.smelt-arrow i { display: block; height: 5px; margin-top: 10px; overflow: hidden; background: rgba(255,255,255,.1); }
.smelt-arrow i b { display: block; width: 0; height: 100%; background: linear-gradient(90deg,#ff783c,#ffd55e); transition: width .1s linear; }
.furnace-window > p { color: #aebaa2; font-size: 12px; }
.furnace-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; }
.furnace-actions .primary-button { flex: 1 1 112px; padding-inline: 12px; }
.gold-button { background: #e6bb3f; }
.gold-button:hover { background: #f4d269; }
.glass-button { background: #8ecbd4; }
.glass-button:hover { background: #addde3; }
.cook-button { background: #ffad55; }
.cook-button:hover { background: #ffc477; }
.furnace-window footer { margin-top: 22px; color: #8f9d83; font-size: 9px; }
.furnace-window footer b { color: #dbe4d0; }

.victory-mark { color: var(--gold); font-size: 34px; margin-bottom: 10px; text-shadow: 0 0 20px rgba(255,214,107,.35); }
.victory-stats { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); margin: 20px 0 24px; }
.victory-stats div { padding: 15px; }
.victory-stats div + div { border-left: 1px solid var(--line); }
.victory-stats b { display: block; font: 700 25px Georgia, serif; color: var(--gold); }
.victory-stats span { color: #9eaa91; font-size: 8px; letter-spacing: .14em; }

#toast { position: fixed; z-index: 40; top: 19%; left: 50%; transform: translate(-50%, -15px); min-width: 190px; padding: 10px 15px; background: rgba(14,20,12,.9); border-left: 3px solid var(--green); text-align: center; color: white; font-size: 11px; font-weight: 750; letter-spacing: .04em; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 760px) {
  .quest-card { width: 210px; }
  .quest-card h2 { font-size: 17px; }
  .quest-card li { font-size: 10px; }
  .stats-card { width: 210px; }
  .inventory-mini { grid-template-columns: repeat(4, 1fr); }
  .slot { width: 64px; height: 60px; }
  .recipe-list { grid-template-columns: 1fr; }
  .lan-layout { grid-template-columns: 1fr; }
  .lan-window { max-height: calc(100vh - 16px); }
  .lan-hud-card { display: none; }
  .mini-map { left: 12px; bottom: 12px; width: 166px; padding: 8px; }
  .mini-map canvas { width: 148px; height: 148px; }
  .chat-panel { left: 190px; right: 12px; bottom: 92px; width: auto; min-width: 0; transform: none; }
  .world-map-layout { grid-template-columns: 1fr; }
  .world-map-frame canvas { width: min(100%, 60vh); }
  .map-roster { max-height: 145px; overflow: auto; }
}

@media (max-width: 520px) {
  #hotbar { gap: 4px; }
  .slot { width: 54px; height: 58px; }
  .slot b { max-width: 50px; overflow: hidden; font-size: 7px; text-overflow: ellipsis; white-space: nowrap; }
  .quest-card { top: 58px; left: 10px; padding: 10px; width: 184px; }
  .quest-card li { gap: 6px; }
  .stats-card { top: 58px; right: 10px; width: 150px; }
  .inventory-mini { grid-template-columns: repeat(2, 1fr); }
  .inventory-mini > div { height: 42px; grid-template: 24px / 24px 1fr; }
  .inventory-mini small { display: none; }
  .top-bar { left: 12px; right: 12px; top: 14px; }
  .music-toggle { right: 12px; bottom: 92px; width: 36px; height: 36px; justify-content: center; padding: 0; }
  .music-toggle b { display: none; }
  .lan-status-button { position: fixed; top: 43px; left: 12px; }
  .start-actions { max-width: 310px; margin: auto; }
  .start-actions > button { width: 100%; }
  .lan-address-fields { grid-template-columns: 1fr 76px; }
  .lan-buttons { display: grid; }
  .mini-map { bottom: 92px; width: 136px; }
  .mini-map canvas { width: 118px; height: 118px; }
  .mini-map-coordinates { font-size: 7px; }
  .chat-panel { left: 12px; right: 12px; bottom: 170px; }
  .map-window { max-height: calc(100vh - 12px); padding: 15px; }
  .world-map-layout { gap: 11px; margin-top: 11px; }
  .world-map-frame canvas { width: 100%; }
}
