:root {
  --ink: #eaf7f2;
  --muted: #9cb4b2;
  --glass: rgba(8, 19, 34, 0.72);
  --line: rgba(205, 244, 226, 0.2);
  --mint: #9effce;
  --gold: #ffd978;
  --violet: #a98cff;
  --sky-top: #3f78a9;
  --sky-bottom: #d8dfc7;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #07111f;
  color: var(--ink);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  user-select: none;
}

button { font: inherit; }

#game-shell {
  position: relative;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 73% 25%, rgba(255, 231, 156, .38), transparent 20%),
    linear-gradient(180deg, var(--sky-top), var(--sky-bottom));
  transition: background 1s linear;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
}

.screen {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .45s ease;
  background: linear-gradient(90deg, rgba(2, 10, 20, .88) 0 38%, rgba(3, 12, 23, .22) 72%, rgba(2, 8, 18, .48));
}

.screen.visible { opacity: 1; pointer-events: auto; }

#start-screen::before {
  content: "";
  position: absolute;
  inset: 28px;
  border: 1px solid rgba(226, 255, 240, .18);
  pointer-events: none;
}

.start-card {
  position: absolute;
  left: clamp(48px, 9vw, 150px);
  top: 50%;
  width: min(500px, 45vw);
  transform: translateY(-50%);
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--mint);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .23em;
}

.eyebrow span { width: 35px; height: 1px; background: var(--mint); box-shadow: 0 0 12px var(--mint); }

h1 {
  margin: 22px 0 12px;
  font-family: Georgia, "Songti SC", serif;
  font-size: clamp(68px, 10vw, 142px);
  font-weight: 500;
  letter-spacing: -.09em;
  line-height: .68;
  text-shadow: 0 10px 50px rgba(0,0,0,.3);
}

h1 em {
  padding-left: .42em;
  color: transparent;
  font-style: normal;
  -webkit-text-stroke: 1px rgba(220, 255, 239, .82);
}

.subtitle { margin: 34px 0; color: #c5d9d3; font-family: Georgia, "Songti SC", serif; letter-spacing: .16em; }

.primary-button {
  position: relative;
  width: min(340px, 100%);
  padding: 18px 20px;
  border: 1px solid rgba(177,255,219,.46);
  color: #071b1b;
  background: linear-gradient(105deg, #b8ffdc, #79dcb7);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 800;
  letter-spacing: .12em;
  box-shadow: 0 14px 40px rgba(63,221,164,.16);
  transition: transform .2s, filter .2s;
}

.primary-button:hover { transform: translateY(-2px); filter: brightness(1.08); }
.primary-button b { font-size: 9px; opacity: .48; letter-spacing: .16em; }

.start-meta {
  width: min(340px, 100%);
  display: flex;
  justify-content: space-between;
  margin-top: 18px;
  color: #78928f;
  font-size: 9px;
  letter-spacing: .12em;
}

.start-meta b { display: block; margin-top: 5px; color: #b3cbc5; font-size: 10px; }

.start-aside {
  position: absolute;
  right: 6vw;
  bottom: 9vh;
  width: 240px;
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 15px;
  color: #b9cfcb;
  font-size: 12px;
  line-height: 1.8;
}

.feature-number { color: var(--gold); font-family: Georgia, serif; font-size: 42px; line-height: 1; opacity: .78; }
.start-aside p { margin: 0; border-left: 1px solid var(--line); padding-left: 15px; }
kbd { padding: 2px 6px; border: 1px solid rgba(218,255,237,.24); background: rgba(0,0,0,.22); color: #eafff4; font: 700 9px/1.4 Inter, sans-serif; }

#pause-screen { background: rgba(4, 10, 18, .63); backdrop-filter: blur(9px); }
.pause-card { width: min(430px, calc(100% - 40px)); padding: 48px; border: 1px solid var(--line); background: var(--glass); box-shadow: 0 30px 90px rgba(0,0,0,.3); }
.pause-kicker { color: var(--mint); font-size: 10px; letter-spacing: .24em; }
.pause-card h2 { font: 38px Georgia, "Songti SC", serif; margin: 13px 0; }
.pause-card p { color: var(--muted); margin-bottom: 28px; }

#hud { position: absolute; inset: 0; z-index: 10; pointer-events: none; opacity: 1; transition: opacity .3s; }
#hud.hidden { opacity: 0; }
.top-bar { position: absolute; top: 26px; left: 30px; right: 30px; display: flex; justify-content: space-between; align-items: flex-start; }
.brand-mark { display: flex; align-items: center; gap: 11px; text-shadow: 0 2px 15px #07111f; }
.brand-mark i { width: 27px; height: 27px; border: 1px solid var(--mint); transform: rotate(45deg); box-shadow: inset 0 0 13px rgba(158,255,206,.2), 0 0 13px rgba(158,255,206,.18); }
.brand-mark i::after { content: ""; display: block; width: 7px; height: 7px; margin: 9px; background: var(--mint); }
.brand-mark span { font: 18px Georgia, "Songti SC", serif; letter-spacing: .18em; }
.brand-mark small { display: block; margin-top: 3px; color: var(--muted); font: 7px Inter, sans-serif; letter-spacing: .28em; }
.world-state { display: flex; gap: 10px; align-items: center; text-align: right; padding: 9px 12px; border-right: 2px solid var(--gold); background: linear-gradient(90deg, transparent, rgba(4,14,25,.32)); }
.world-state > span { color: var(--gold); font-size: 20px; }
.world-state small { display: block; color: #fff0bd; font: 10px Georgia, serif; letter-spacing: .16em; }
.world-state b { display: block; margin-top: 4px; font-size: 8px; color: #b1c3c2; letter-spacing: .1em; }

.objective-card { position: absolute; left: 30px; top: 105px; width: 235px; padding: 15px 17px; border-left: 1px solid var(--mint); background: linear-gradient(90deg, rgba(4,16,28,.58), transparent); }
.objective-card small { display: block; color: var(--mint); font-size: 8px; letter-spacing: .22em; }
.objective-card strong { display: block; margin: 7px 0 11px; font: 13px Georgia, "Songti SC", serif; letter-spacing: .08em; }
.objective-progress { height: 2px; background: rgba(255,255,255,.13); }
.objective-progress i { display: block; width: 0; height: 100%; background: var(--mint); box-shadow: 0 0 9px var(--mint); transition: width .35s; }

#crosshair { position: absolute; left: 50%; top: 50%; width: 20px; height: 20px; transform: translate(-50%,-50%); filter: drop-shadow(0 1px 2px #000); }
#crosshair i, #crosshair b { position: absolute; background: rgba(236,255,246,.9); }
#crosshair i { width: 1px; height: 18px; left: 9px; top: 1px; }
#crosshair b { height: 1px; width: 18px; left: 1px; top: 9px; }

#toast { position: absolute; left: 50%; top: calc(50% + 45px); transform: translateX(-50%) translateY(8px); opacity: 0; padding: 7px 12px; background: rgba(6,15,25,.72); border: 1px solid var(--line); color: #d9eee7; font-size: 10px; letter-spacing: .1em; transition: .25s; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.energy-panel { position: absolute; left: 30px; bottom: 31px; display: flex; align-items: center; gap: 14px; }
.energy-orb { position: relative; width: 58px; height: 58px; display: grid; place-items: center; border: 1px solid rgba(169,140,255,.5); transform: rotate(45deg); background: rgba(12,14,40,.52); box-shadow: inset 0 0 22px rgba(169,140,255,.13); }
.energy-orb span { transform: rotate(-45deg); color: #d9cfff; font: 18px Georgia, serif; }
.energy-orb i { position: absolute; inset: 6px; border: 1px dashed rgba(193,177,255,.24); animation: spin 10s linear infinite; }
.energy-panel div:last-child { display: flex; flex-direction: column; gap: 3px; }
.energy-panel small { color: #bdaeff; font-size: 8px; letter-spacing: .2em; }
.energy-panel strong { font: 13px Georgia, "Songti SC", serif; }
.energy-panel em { color: #829a99; font-size: 8px; font-style: normal; letter-spacing: .1em; }
@keyframes spin { to { transform: rotate(360deg); } }

.controls-hint { position: absolute; right: 30px; bottom: 32px; display: flex; gap: 16px; color: rgba(223,240,235,.55); font-size: 8px; letter-spacing: .05em; }
.controls-hint kbd { margin-right: 4px; }

#hotbar { position: absolute; left: 50%; bottom: 28px; display: flex; gap: 7px; transform: translateX(-50%); }
.slot { position: relative; width: 54px; height: 54px; padding: 5px; border: 1px solid rgba(224,255,241,.18); background: rgba(5,13,24,.58); backdrop-filter: blur(7px); transition: .18s; }
.slot.selected { transform: translateY(-7px); border-color: var(--mint); box-shadow: 0 7px 22px rgba(68,245,178,.15), inset 0 0 16px rgba(118,255,204,.08); }
.slot .swatch { display: block; width: 100%; height: 100%; background: var(--block-color); box-shadow: inset -10px -10px 0 rgba(0,0,0,.13), inset 8px 8px 0 rgba(255,255,255,.09); }
.slot .index { position: absolute; left: 3px; top: 1px; color: rgba(255,255,255,.67); font-size: 8px; }
.slot .count { position: absolute; right: 4px; bottom: 3px; color: white; font: 9px Georgia, serif; text-shadow: 0 1px 2px #000; }
.slot .name { position: absolute; bottom: -19px; left: 50%; transform: translateX(-50%); white-space: nowrap; opacity: 0; color: var(--mint); font-size: 8px; letter-spacing: .08em; }
.slot.selected .name { opacity: 1; }

#damage-flash { position: absolute; inset: 0; z-index: 9; pointer-events: none; background: rgba(255, 99, 112, .28); opacity: 0; }
#damage-flash.flash { animation: flash .35s; }
@keyframes flash { 30% { opacity: 1; } }
.grain { position: absolute; inset: 0; z-index: 30; pointer-events: none; opacity: .035; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E"); }

@media (max-width: 760px) {
  .start-card { left: 32px; width: calc(100% - 64px); }
  h1 { font-size: 82px; }
  .start-aside, .controls-hint, .objective-card { display: none; }
  .energy-panel { left: 20px; bottom: 100px; }
  #hotbar { bottom: 24px; max-width: calc(100% - 24px); }
  .slot { width: 44px; height: 44px; }
}
