/* NovaEvo frontend v3 — dynamic world */

:root {
  --ink: #f5f7ff;
  --muted: #a7b3d7;
  --glass: rgba(12, 20, 51, .72);
  --glass-light: rgba(32, 45, 89, .75);
  --line: rgba(183, 205, 255, .16);
  --cyan: #5ce8e2;
  --lime: #c9f27b;
  --violet: #9d8cff;
  --orange: #ffba76;
  --ether-color: #5ce8e2;
  --wood-color: #c9f27b;
  --crystal-color: #b08aff;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #080e28; color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
#game { position: fixed; inset: 0; }
canvas { display: block; }
.noise { position: fixed; inset: 0; pointer-events: none; opacity: .035; z-index: 2; 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='.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E"); }

.ui { position: fixed; inset: 0; z-index: 3; pointer-events: none; }

/* Topbar */
.topbar { position: absolute; left: 28px; right: 28px; top: 24px; display: flex; align-items: flex-start; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 12px; pointer-events: auto; user-select: none; }
.brand-mark { width: 42px; height: 42px; border-radius: 14px; position: relative; overflow: hidden; background: linear-gradient(145deg, #d9ff87, #56e5db 50%, #8f79ff); box-shadow: 0 8px 32px rgba(93, 232, 226, .28); }
.brand-mark:before, .brand-mark:after { content: ""; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .7); filter: blur(1px); }
.brand-mark:before { width: 26px; height: 26px; top: -8px; right: -5px; }
.brand-mark:after { width: 17px; height: 17px; bottom: 4px; left: 6px; background: rgba(10, 25, 67, .34); }
.brand-name { font-weight: 800; letter-spacing: -.07em; font-size: 24px; line-height: 1; }
.brand-name span { color: var(--lime); }
.eyebrow { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; margin-top: 5px; }
.top-actions { display: flex; gap: 10px; pointer-events: auto; }
button { border: 1px solid var(--line); color: var(--ink); background: var(--glass); border-radius: 12px; padding: 7px 14px; font: 600 12px/1 Inter, sans-serif; cursor: pointer; transition: background .2s, border-color .2s; }
button:hover { background: var(--glass-light); border-color: rgba(183, 205, 255, .28); }
.pill { display: flex; align-items: center; gap: 7px; border-radius: 20px; padding: 6px 14px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--lime); display: inline-block; animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }

/* Panels */
.panel { position: absolute; pointer-events: auto; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); background: var(--glass); border: 1px solid var(--line); border-radius: 18px; padding: 18px; }
.left-panel { left: 24px; top: 90px; width: 220px; }
.right-panel { right: 24px; top: 90px; width: 230px; }

/* Profile */
.profile { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.avatar { width: 38px; height: 38px; border-radius: 12px; background: linear-gradient(135deg, #735eff, #55eee5); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 16px; color: #0a1129; flex-shrink: 0; }
.profile strong { font-size: 14px; display: block; }
.profile small { color: var(--muted); font-size: 10px; }
.level { margin-left: auto; background: var(--lime); color: #0a1129; font-weight: 800; font-size: 10px; padding: 3px 8px; border-radius: 8px; letter-spacing: .08em; }

/* XP Bar */
.xp-bar-wrap { margin-top: 12px; }
.xp-bar { width: 100%; height: 5px; background: rgba(255, 255, 255, .08); border-radius: 4px; overflow: hidden; }
.xp-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--violet), var(--cyan)); border-radius: 4px; transition: width .6s cubic-bezier(.22, 1, .36, 1); }
.xp-label { display: flex; justify-content: space-between; margin-top: 4px; }
.xp-label span { font-size: 9px; color: var(--muted); font-weight: 600; letter-spacing: .06em; }

/* Stamina */
.stamina-wrap { margin-top: 10px; display: flex; align-items: center; gap: 6px; }
.stamina-label { font-size: 9px; color: var(--muted); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.stamina-bar { flex: 1; height: 4px; background: rgba(255, 255, 255, .08); border-radius: 3px; overflow: hidden; }
.stamina-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #ff6b6b, #ffd93d, #6bcb77); border-radius: 3px; transition: width .3s; }
.stamina-value { font-size: 10px; color: var(--orange); font-weight: 700; min-width: 22px; text-align: right; }

/* Resources */
.resources { margin-top: 14px; }
.section-label { font-size: 9px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.resource { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.resource:last-child { border-bottom: none; }
.resource-icon { width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; }
.ether-icon { background: rgba(92, 232, 226, .15); color: var(--ether-color); }
.wood-icon { background: rgba(201, 242, 123, .15); color: var(--wood-color); }
.crystal-icon { background: rgba(176, 138, 255, .15); color: var(--crystal-color); }
.resource-name { flex: 1; font-size: 12px; font-weight: 600; }
.resource-value { font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .04em; }

/* Right panel — world card */
.world-card h3 { font-size: 14px; margin: 8px 0 4px; font-weight: 700; }
.world-card p { font-size: 11px; color: var(--muted); line-height: 1.45; margin: 0 0 10px; }
.progress { width: 100%; height: 5px; background: rgba(255, 255, 255, .08); border-radius: 4px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 68%; background: linear-gradient(90deg, var(--cyan), var(--lime)); border-radius: 4px; transition: width 1s; }
.statline { display: flex; justify-content: space-between; margin-top: 6px; font-size: 11px; }
.statline span { color: var(--muted); }
.statline b { color: var(--lime); }

/* Event Banner */
.event-banner {
  position: absolute;
  top: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(-60px);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: rgba(12, 20, 51, .88);
  backdrop-filter: blur(12px);
  border: 1px solid var(--violet);
  border-radius: 14px;
  pointer-events: auto;
  opacity: 0;
  transition: transform .5s cubic-bezier(.22, 1, .36, 1), opacity .5s;
  z-index: 10;
  max-width: 380px;
}
.event-banner.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.event-icon {
  font-size: 22px;
  flex-shrink: 0;
  animation: eventGlow 2s infinite;
}
@keyframes eventGlow {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.5); }
}
.event-text { flex: 1; }
.event-text strong { display: block; font-size: 12px; font-weight: 700; color: var(--violet); }
.event-text span { font-size: 11px; color: var(--muted); }
.event-timer { font-size: 11px; font-weight: 700; color: var(--orange); min-width: 28px; text-align: right; }

/* Player inspect */
.player-inspect { right: 24px; bottom: 100px; width: 210px; display: none; }
.player-inspect.show { display: block; }
.inspect-head { display: flex; align-items: center; gap: 8px; }
.inspect-close { margin-left: auto; background: none; border: none; font-size: 18px; cursor: pointer; padding: 2px 6px; }
.inspect-actions { display: flex; gap: 8px; margin-top: 10px; }
.inspect-actions button { flex: 1; text-align: center; font-size: 11px; }

/* Crosshair */
.crosshair { position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; transform: translate(-50%, -50%); pointer-events: none; }
.crosshair::before, .crosshair::after { content: ""; position: absolute; background: rgba(245, 247, 255, .35); border-radius: 2px; }
.crosshair::before { width: 2px; height: 18px; left: 8px; top: 0; }
.crosshair::after { width: 18px; height: 2px; top: 8px; left: 0; }

/* Toast */
.toast {
  position: absolute;
  bottom: 140px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  padding: 10px 20px;
  background: rgba(12, 20, 51, .92);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  pointer-events: none;
  opacity: 0;
  transition: opacity .3s, transform .3s;
  z-index: 20;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Bottom section */
.bottom { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.hint { font-size: 11px; color: var(--muted); text-align: center; pointer-events: none; }

/* Build menu */
.build-menu {
  display: none;
  background: var(--glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  pointer-events: auto;
}
.build-menu.show { display: block; }
.build-menu-title { font-size: 13px; font-weight: 700; margin-bottom: 10px; }
.build-menu-title small { color: var(--muted); font-weight: 400; margin-left: 6px; font-size: 10px; }
.build-options { display: flex; gap: 8px; }
.build-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  transition: all .2s;
  min-width: 72px;
}
.build-option b { font-size: 18px; }
.build-option span { font-size: 10px; font-weight: 600; }
.build-option small { font-size: 9px; color: var(--muted); }
.build-option.active { border-color: var(--cyan); background: rgba(92, 232, 226, .08); }

/* Toolbar */
.toolbar {
  display: flex;
  gap: 6px;
  background: var(--glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 6px;
  pointer-events: auto;
}
.tool {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  transition: all .2s;
}
.tool b { font-size: 16px; }
.tool span { font-size: 9px; font-weight: 600; }
.tool.active { border-color: var(--cyan); background: rgba(92, 232, 226, .1); }

/* Auth screen */
.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #080e28;
}
.auth-screen.hidden { display: none; }
.auth-card {
  width: 340px;
  padding: 32px;
  background: var(--glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--line);
  border-radius: 20px;
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.auth-card h1 { font-size: 20px; margin: 0 0 6px; font-weight: 800; }
.auth-card > p { font-size: 12px; color: var(--muted); margin: 0 0 18px; line-height: 1.5; }
.auth-card label { display: block; font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 5px; margin-top: 12px; }
.auth-card input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, .04);
  color: var(--ink);
  font: 13px/1.4 Inter, sans-serif;
  outline: none;
  transition: border-color .2s;
}
.auth-card input:focus { border-color: var(--cyan); }
.auth-submit {
  width: 100%;
  margin-top: 18px;
  padding: 11px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  color: #0a1129;
  font: 700 13px/1 Inter, sans-serif;
  cursor: pointer;
  transition: opacity .2s;
}
.auth-submit:disabled { opacity: .5; }
.auth-switch { width: 100%; margin-top: 10px; background: none; border: none; color: var(--muted); font-size: 11px; cursor: pointer; text-align: center; padding: 6px; }
.auth-switch:hover { color: var(--ink); }
.auth-error { margin-top: 12px; font-size: 11px; color: #ff6b6b; min-height: 16px; }

/* Loading */
.loading {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #080e28;
  transition: opacity .6s;
}
.loading.hide { opacity: 0; pointer-events: none; }
.loader-inner { text-align: center; }
.loader-inner .brand-mark { margin: 0 auto 16px; }
.loader-inner p { color: var(--muted); font-size: 13px; margin-top: 8px; }

/* Responsive */
@media (max-width: 640px) {
  .left-panel { width: 180px; padding: 14px; left: 10px; }
  .right-panel { display: none; }
  .build-options { flex-wrap: wrap; }
}
