:root {
  --panel: rgba(18, 24, 38, .82);
  --line: rgba(255, 255, 255, .1);
  --text: #eef2f8;
  --muted: #9aa7bd;
  --accent: #4ade80;
  --accent2: #38bdf8;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #9fd3f0; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--text); }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
[hidden] { display: none !important; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; backdrop-filter: blur(8px); box-shadow: 0 8px 30px rgba(0,0,0,.25); }
button { font: inherit; color: inherit; cursor: pointer; border: 1px solid var(--line); background: rgba(255,255,255,.06); border-radius: 10px; padding: 7px 12px; transition: background .15s, transform .1s; }
button:hover { background: rgba(255,255,255,.14); }
button:active { transform: scale(.97); }
button.primary { background: var(--accent); color: #0b2414; font-weight: 700; border: none; }
button.primary:hover { background: #6ee7a0; }
input { font: inherit; color: var(--text); background: rgba(0,0,0,.3); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; outline: none; width: 100%; }
input:focus { border-color: var(--accent2); }

/* Giriş */
#login { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(380px, calc(100% - 32px)); padding: 26px; display: flex; flex-direction: column; gap: 8px; z-index: 5; }
#login h1 { margin: 0; font-size: 40px; letter-spacing: -1px; }
#login h1 span { color: var(--accent); }
#login .sub { margin: 0 0 10px; color: var(--muted); }
#login label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-top: 6px; }
#login .primary { margin-top: 14px; padding: 12px; font-size: 16px; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatches i { width: 28px; height: 28px; border-radius: 7px; cursor: pointer; border: 2px solid transparent; box-shadow: inset 0 -4px 0 rgba(0,0,0,.2); }
.swatches i.sel { border-color: #fff; transform: scale(1.1); }
.err { color: #fca5a5; min-height: 18px; font-size: 14px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: rgba(0,0,0,.25); padding: 4px; border-radius: 12px; }
.tabs button { border: none; background: transparent; }
.tabs button.active { background: rgba(255,255,255,.14); font-weight: 700; }
#regFields { display: flex; flex-direction: column; gap: 8px; }
.gift { margin: 8px 0 0; padding: 8px 10px; border-radius: 10px; background: rgba(74,222,128,.12); border: 1px solid rgba(74,222,128,.35); font-size: 14px; }

#nav { position: fixed; top: 64px; left: 12px; display: flex; gap: 6px; padding: 6px; align-items: center; flex-wrap: wrap; max-width: calc(100% - 24px); }
#nav #place { font-weight: 700; padding: 0 8px; }
#nav button { padding: 5px 10px; font-size: 14px; }
#nav a { color: inherit; text-decoration: none; }
#nav button.here { background: var(--accent2); color: #062033; }
#visitForm { display: flex; gap: 4px; }
#visitForm input { width: 160px; padding: 5px 10px; font-size: 14px; }

/* HUD */
#topbar { position: fixed; top: 12px; left: 12px; display: flex; gap: 16px; padding: 10px 16px; font-weight: 600; align-items: center; }
#money { color: var(--accent); }
#clock, #online { color: var(--muted); }
#modes { position: fixed; top: 12px; right: 12px; display: flex; gap: 6px; padding: 6px; }
#modes button.active { background: var(--accent2); color: #062033; border-color: transparent; font-weight: 700; }

#status { position: fixed; top: 120px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; }
#status .bar { width: 120px; height: 8px; background: rgba(255,255,255,.12); border-radius: 4px; overflow: hidden; }
#status .bar i { display: block; height: 100%; width: 0; background: var(--accent2); }
#status button { padding: 2px 8px; }

#needs { position: fixed; bottom: 12px; left: 12px; padding: 12px 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; width: 330px; }
.need { font-size: 12px; }
.need .lbl { display: flex; justify-content: space-between; color: var(--muted); margin-bottom: 3px; }
.need .bar { height: 9px; background: rgba(255,255,255,.1); border-radius: 5px; overflow: hidden; }
.need .bar i { display: block; height: 100%; border-radius: 5px; transition: width .3s, background .3s; }
.need.low .lbl { color: #fca5a5; }
#moodRow { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }

#catalog { position: fixed; bottom: 12px; left: 354px; right: 344px; padding: 10px; max-height: 260px; display: flex; flex-direction: column; gap: 8px; }
#cats { display: flex; gap: 4px; flex-wrap: wrap; }
#cats button { padding: 4px 10px; font-size: 13px; }
#cats button.active { background: var(--accent2); color: #062033; }
#items { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; overflow-y: auto; }
.item { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; font-size: 12px; text-align: center; }
.item .ic { font-size: 26px; }
.item .pr { color: var(--accent); font-weight: 700; }
.item.sel { outline: 2px solid var(--accent2); background: rgba(56,189,248,.18); }
.item.poor { opacity: .45; }
.hint { font-size: 12px; color: var(--muted); }

#chat { position: fixed; bottom: 12px; right: 12px; width: 320px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
#chatlog { height: 150px; overflow-y: auto; font-size: 13px; line-height: 1.4; display: flex; flex-direction: column; gap: 2px; }
#chatlog .m b { color: var(--accent2); }
#chatlog .m.me b { color: var(--accent); }
#chatlog .m.sys { color: var(--muted); font-style: italic; }
#chatlog .m.emote { color: #fcd34d; }

#help { position: fixed; top: 120px; right: 12px; padding: 8px 12px; font-size: 12px; color: var(--muted); max-width: 300px; line-height: 1.6; }

#menu { position: fixed; z-index: 10; display: flex; flex-direction: column; gap: 4px; padding: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; min-width: 170px; backdrop-filter: blur(8px); }
#menu .title { font-size: 12px; color: var(--muted); padding: 2px 6px 4px; }
#menu button { text-align: left; }
#menu .give-quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
#menu .give-quick button { text-align: center; padding: 6px 4px; font-size: 13px; }
#menu input { margin-top: 2px; }
#menu .primary { text-align: center; }
#chatlog .m.money { color: #4ade80; }
#chatlog .m.announce { color: #fde68a; background: rgba(250,204,21,.12); border-radius: 6px; padding: 2px 6px; font-weight: 600; }

/* gardırop */
#wardrobe { position: fixed; top: 120px; right: 12px; width: 300px; max-height: calc(100% - 350px); min-height: 240px; padding: 14px; display: flex; flex-direction: column; gap: 6px; z-index: 6; }
#wardrobe h3 { margin: 0; font-size: 18px; }
#wardrobe .hint { margin: 0 0 4px; }
#wardBody { overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding-right: 4px; }
#wardBody label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-top: 4px; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chips button { padding: 4px 10px; font-size: 13px; }
.chips button.sel { background: var(--accent2); color: #062033; border-color: transparent; font-weight: 700; }
.ward-btns { display: grid; grid-template-columns: auto 1fr 1fr; gap: 6px; margin-top: 6px; }
.ward-btns button[hidden] + .primary { grid-column: span 2; }

#toasts { position: fixed; top: 170px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast { background: var(--panel); border: 1px solid var(--line); padding: 8px 16px; border-radius: 10px; animation: tin .25s ease-out; font-size: 14px; }
.toast.bad { border-color: #f87171; }
.toast.good { border-color: var(--accent); }
@keyframes tin { from { opacity: 0; transform: translateY(-8px); } }

@media (max-width: 1100px) {
  #catalog { left: 12px; right: 12px; bottom: 210px; }
  #help { display: none; }
}
@media (max-width: 720px) {
  #needs { width: calc(100% - 24px); bottom: 186px; }
  #chat { left: 12px; right: 12px; width: auto; }
  #chatlog { height: 70px; }
  #wardrobe { left: 12px; right: 12px; width: auto; top: 110px; max-height: calc(100% - 330px); min-height: 0; }
  #catalog { bottom: 400px; }
  #topbar { gap: 10px; font-size: 14px; }
}
