:root {
  color-scheme: dark;
  --ink: #eaf4d3;
  --muted: #9fb89b;
  --deep: #101c24;
  --panel: #1b3036;
  --panel-light: #28464a;
  --edge: #0a1419;
  --green: #82c95b;
  --gold: #f2cc60;
  --blue: #66c5cf;
  --red: #e86a5e;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--deep);
  color: var(--ink);
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 14px;
  image-rendering: pixelated;
}
button, input { font: inherit; }
button {
  border: 2px solid var(--edge);
  border-radius: 0;
  padding: 7px 10px;
  color: var(--ink);
  background: var(--panel-light);
  box-shadow: inset -2px -2px 0 #16282c, inset 2px 2px 0 #3d5b58;
  cursor: pointer;
}
button:hover:not(:disabled), button:focus-visible { color: #fff; background: #385c55; outline: 2px solid var(--gold); outline-offset: 1px; }
button:active:not(:disabled) { transform: translateY(1px); box-shadow: inset 2px 2px 0 #16282c; }
button:disabled { opacity: .48; cursor: not-allowed; }
button.primary { background: #538747; color: #fff; }
button.danger { background: #75443e; }
button.wide { width: 100%; padding: 11px; font-weight: bold; }
input {
  width: 100%;
  border: 2px solid #0b181c;
  border-radius: 0;
  padding: 10px;
  background: #10252b;
  color: #fff;
  outline: none;
}
input:focus { border-color: var(--gold); }
label { display: block; margin: 14px 0 6px; color: var(--muted); }
h1, h2, p { margin-top: 0; }
h2 { font-size: 15px; margin-bottom: 10px; }
kbd { background: #0c1b20; border: 1px solid #49605a; padding: 2px 4px; color: #fff; }

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(#172f37 0 65%, #21483f 65% 68%, #172f37 68%),
    repeating-linear-gradient(90deg, transparent 0 16px, #1b343b 16px 18px);
}
.auth-card { width: min(100%, 390px); padding: 28px; }
.pixel-panel {
  background: var(--panel);
  border: 3px solid var(--edge);
  box-shadow: inset 0 0 0 2px #34504e, 5px 5px 0 #091317;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 900; letter-spacing: 4px; color: var(--gold); }
.brand-large { justify-content: center; font-size: 30px; }
.fish-mark { position: relative; display: inline-block; width: 24px; height: 14px; background: var(--blue); box-shadow: 4px 4px 0 #347985; }
.fish-mark::before { content: ""; position: absolute; left: -8px; top: 3px; border-top: 4px solid transparent; border-bottom: 4px solid transparent; border-right: 8px solid var(--blue); }
.fish-mark::after { content: ""; position: absolute; right: 4px; top: 3px; width: 3px; height: 3px; background: var(--deep); }
.tagline { text-align: center; color: var(--muted); line-height: 1.5; margin: 14px 0 22px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 16px; }
.segmented button.active { background: #538747; color: white; }
.hint { color: var(--muted); font-size: 12px; line-height: 1.45; }
.error-text { min-height: 18px; color: #ff9c8f; font-size: 12px; }

.topbar { min-height: 58px; display: flex; align-items: center; gap: 22px; padding: 10px 22px; border-bottom: 3px solid #071115; background: #172b32; }
.connection { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.dot { width: 8px; height: 8px; background: var(--gold); }
.dot.online { background: var(--green); }
.dot.offline { background: var(--red); }
.account { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.account span { color: var(--gold); font-weight: bold; }

.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; max-width: 1500px; margin: 0 auto; padding: 18px; }
.play-column { min-width: 0; }
.canvas-frame { position: relative; display: grid; place-items: center; min-height: 280px; overflow: hidden; background: #091418; border: 4px solid #071014; box-shadow: 0 0 0 3px #34504e; }
canvas { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; image-rendering: pixelated; image-rendering: crisp-edges; cursor: crosshair; outline: none; background: #6a9b51; }
canvas:focus { box-shadow: inset 0 0 0 2px var(--gold); }
.canvas-message { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); max-width: calc(100% - 24px); padding: 7px 12px; background: #0b1a20e8; border: 2px solid #4a6057; color: #fff; font-size: 12px; text-align: center; pointer-events: none; white-space: nowrap; }
.canvas-message.urgent { color: #1b2422; background: var(--gold); border-color: #fff0a0; font-weight: bold; animation: blink .4s steps(2) infinite; }
@keyframes blink { 50% { transform: translateX(-50%) translateY(-2px); } }
.fishing-bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 12px; padding: 12px; }
.fishing-bar strong { display: block; color: var(--gold); margin-bottom: 4px; }
.fishing-bar span { color: var(--muted); font-size: 11px; }
.bite-track { flex: 0 0 130px; height: 12px; padding: 2px; background: #0b1a20; border: 1px solid #49605a; }
#bite-fill { width: 0; height: 100%; background: var(--gold); }
.help { display: flex; flex-wrap: wrap; gap: 12px 18px; margin-top: 12px; padding: 10px 12px; color: var(--muted); font-size: 11px; }
#player-count { margin-left: auto; color: var(--green); }
.event-feed { display: grid; gap: 5px; margin-top: 12px; }
.event { padding: 8px 10px; border-left: 3px solid var(--blue); background: #172a30; color: var(--muted); font-size: 12px; }
.event.good { border-color: var(--green); color: var(--ink); }
.event.rare { border-color: var(--gold); color: var(--gold); }

.side-column { display: grid; align-content: start; gap: 12px; }
.side-column section { padding: 14px; }
.profile-heading, .section-heading, .xp-label, .gold-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.profile-heading h2 { margin: 0; overflow: hidden; text-overflow: ellipsis; }
.level-badge { flex: none; padding: 4px 6px; background: var(--gold); color: #27322a; font-weight: bold; }
.xp-label { margin: 14px 0 5px; color: var(--muted); font-size: 11px; }
.xp-track { height: 10px; padding: 2px; background: #0d1c21; }
#xp-fill { height: 100%; width: 0; background: var(--green); transition: width .25s; }
.gold-row { margin-top: 12px; color: var(--muted); }
.gold-row strong { color: var(--gold); font-size: 18px; }
.equipped-list { display: grid; gap: 7px; }
.equipped-item { padding: 8px; background: #14282e; border-left: 3px solid var(--blue); }
.equipped-item small { display: block; color: var(--muted); margin-bottom: 3px; }
.item-list { display: grid; gap: 8px; max-height: 330px; overflow-y: auto; }
.item-row { padding: 9px; background: #14282e; border: 1px solid #2c4647; }
.item-row.locked { opacity: .65; }
.item-title { display: flex; justify-content: space-between; gap: 8px; font-weight: bold; }
.item-meta { margin: 5px 0 8px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.item-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.item-actions button { padding: 5px 7px; font-size: 11px; }
.empty { color: var(--muted); font-size: 12px; padding: 8px 0; }
.section-heading span { color: var(--muted); font-size: 11px; }

.toast { position: fixed; z-index: 20; top: 70px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 30px); padding: 12px 18px; background: #263f42; border: 3px solid var(--gold); color: #fff; box-shadow: 5px 5px 0 #081115; text-align: center; }
.toast.good { border-color: var(--green); }
.toast.bad { border-color: var(--red); }

@media (min-width: 1180px) {
  canvas { width: min(100%, 960px); }
}
@media (max-width: 900px) {
  .game-layout { grid-template-columns: 1fr; padding: 10px; }
  .side-column { grid-template-columns: 1fr 1fr; }
  .topbar { padding: 10px; gap: 12px; }
  .connection { display: none; }
}
@media (max-width: 580px) {
  .side-column { grid-template-columns: 1fr; }
  .brand { font-size: 12px; letter-spacing: 2px; }
  .account { gap: 6px; }
  .account span { max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
  .canvas-message { font-size: 10px; white-space: normal; }
  .fishing-bar { align-items: stretch; flex-direction: column; }
  .bite-track { flex-basis: 12px; width: 100%; }
  .help { display: none; }
}
