* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #090f0b;
  --panel: rgba(9, 15, 11, .82);
  --panel-solid: #0d1510;
  --card2: rgba(255, 255, 255, .05);
  --text: #e8e6d9;
  --muted: #96a08f;
  --gold: #cfa94f;
  --gold-bright: #e7c86a;
  --gold-dark: #8a7434;
  --hairline: rgba(207, 169, 79, .35);
  --danger: #ff8b7a;
  --serif: Georgia, 'Palatino Linotype', 'Times New Roman', serif;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
}

/* prosedürel orman arka planı (app.js çizer) */
#ambient { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; }

.screen { display: none; position: fixed; inset: 0; z-index: 1; }
.screen.active { display: flex; align-items: center; justify-content: center; }

.lang-switch {
  position: fixed;
  top: 14px; right: 16px;
  z-index: 30;
  display: flex;
  gap: 2px;
}
.lang-switch button {
  padding: 4px 10px;
  font-size: .72rem;
  letter-spacing: .15em;
  border-radius: 3px;
  background: rgba(9, 15, 11, .6);
}
.lang-switch button.active { border-color: var(--gold); color: var(--gold-bright); }
body.in-game .lang-switch { display: none; }

.online {
  color: var(--muted);
  font-size: .8rem;
  letter-spacing: .1em;
  margin-top: 14px;
}
.online.small { font-size: .72rem; margin: 6px 0 0; }

kbd {
  display: inline-block;
  min-width: 20px;
  text-align: center;
  padding: 2px 7px;
  margin: 0 1px;
  border: 1px solid var(--hairline);
  border-bottom-width: 3px;
  border-radius: 5px;
  background: rgba(255, 255, 255, .07);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: .78rem;
  color: var(--gold-bright);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: 26px;
  backdrop-filter: blur(4px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .6);
}

h2 { margin-bottom: 8px; font-family: var(--serif); font-weight: normal; letter-spacing: .06em; }
h3 {
  margin: 20px 0 10px;
  color: var(--gold);
  font-family: var(--serif);
  font-weight: normal;
  font-size: .8rem;
  letter-spacing: .35em;
  text-transform: uppercase;
}

.hint { color: var(--muted); font-size: .82rem; margin-top: 6px; }
.hint.tiny { font-size: .72rem; line-height: 1.4; }
.error { color: var(--danger); min-height: 1.2em; margin-top: 12px; font-size: .88rem; }
.code { color: var(--gold-bright); letter-spacing: .35em; font-family: var(--serif); }

input[type=text], input:not([type]), input[placeholder] {
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(232, 230, 217, .25);
  color: var(--text);
  padding: 9px 4px;
  font-size: 1rem;
  letter-spacing: .05em;
  outline: none;
  width: 100%;
  transition: border-color .2s;
}
input::placeholder { color: rgba(150, 160, 143, .7); }
input:focus { border-bottom-color: var(--gold); }

button {
  background: rgba(255, 255, 255, .04);
  color: var(--text);
  border: 1px solid rgba(232, 230, 217, .2);
  border-radius: 3px;
  padding: 9px 16px;
  font-size: .95rem;
  letter-spacing: .08em;
  cursor: pointer;
  transition: border-color .2s, color .2s, background .2s, box-shadow .2s;
}
button:hover { border-color: var(--gold); color: #fff; box-shadow: 0 0 14px rgba(207, 169, 79, .18); }
button.big { padding: 12px 26px; font-size: 1.05rem; }
button.go {
  background: linear-gradient(180deg, var(--gold-bright), #c39d3d);
  color: #1c1509;
  border-color: transparent;
  border-radius: 999px;
  font-weight: bold;
  letter-spacing: .1em;
}
button.go:hover { box-shadow: 0 0 22px rgba(231, 200, 106, .45); color: #120d04; }
button.go:disabled {
  background: rgba(255, 255, 255, .07); color: var(--muted);
  cursor: not-allowed; box-shadow: none; border-color: rgba(232, 230, 217, .12);
}
button.active-shape { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }

/* ---------- ana ekran: zelda başlık düzeni ---------- */
.home-layout { position: relative; width: 100%; height: 100%; }

.home-title {
  position: absolute;
  left: 8vw;
  bottom: 26vh;
  text-shadow: 0 2px 24px rgba(0, 0, 0, .9);
}
.pre-title {
  color: var(--muted);
  font-size: .8rem;
  letter-spacing: .5em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.home-title h1 {
  font-family: var(--serif);
  font-weight: normal;
  font-size: clamp(3.2rem, 8vw, 6.4rem);
  letter-spacing: .08em;
  color: #f3f1e4;
  line-height: 1;
}
.title-rule {
  height: 1px;
  background: linear-gradient(90deg, var(--gold), rgba(207, 169, 79, 0));
  margin: 16px 0 10px;
}
.sub-title {
  color: var(--gold);
  font-family: var(--serif);
  letter-spacing: .45em;
  text-transform: uppercase;
  font-size: .78rem;
}

.home-menu {
  position: absolute;
  right: 8vw;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
  width: min(300px, 70vw);
  text-align: right;
}
.home-menu input { text-align: right; font-size: 1.05rem; }
#inp-code { text-transform: uppercase; letter-spacing: .3em; }
.menu-label {
  color: var(--muted);
  font-size: .72rem;
  letter-spacing: .3em;
  text-transform: uppercase;
}
.menu-label em { text-transform: none; letter-spacing: .05em; font-style: normal; opacity: .7; }
.menu-greet {
  color: var(--muted);
  font-size: .95rem;
  letter-spacing: .05em;
  margin-bottom: 4px;
}
.menu-greet span { color: var(--gold-bright); font-family: var(--serif); }
.menu-item.small { font-size: .95rem; color: var(--muted); }
.menu-item.tiny { font-size: .8rem; color: var(--muted); letter-spacing: .1em; }
.menu-item.tiny:hover { color: var(--gold-bright); text-shadow: none; }
.join-line { display: flex; align-items: center; gap: 14px; width: 100%; justify-content: flex-end; }
.join-line input { width: 55%; }
.menu-item {
  background: none;
  border: none;
  border-radius: 0;
  color: var(--text);
  font-size: 1.45rem;
  letter-spacing: .06em;
  padding: 4px 0;
  position: relative;
  box-shadow: none;
}
.menu-item::before {
  content: '◆';
  color: var(--gold-bright);
  font-size: .8em;
  margin-right: 14px;
  opacity: 0;
  transition: opacity .15s;
}
.menu-item:hover, .menu-item:focus-visible {
  color: #fff;
  border: none;
  box-shadow: none;
  text-shadow: 0 0 18px rgba(231, 200, 106, .5);
}
.menu-item:hover::before, .menu-item:focus-visible::before { opacity: 1; }
.menu-sep {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, rgba(207, 169, 79, 0), var(--hairline));
  margin: 6px 0;
}

/* ---------- lobi: dikey harita şeritleri ---------- */
.lobby-zelda {
  display: flex;
  gap: 22px;
  width: 100%;
  height: 100%;
  padding: 26px;
}
.lobby-side {
  width: 300px;
  flex-shrink: 0;
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: 22px;
  overflow-y: auto;
  backdrop-filter: blur(4px);
}
.side-title { font-size: 1.3rem; }

.invite-btn {
  width: 100%;
  margin-top: 10px;
  font-size: .82rem;
  letter-spacing: .05em;
}

.player-list { list-style: none; margin: 14px 0; }
.player-list .li-right { display: flex; align-items: center; gap: 8px; }
.give-host {
  padding: 2px 7px;
  font-size: .8rem;
  border-radius: 4px;
  opacity: .55;
}
.give-host:hover { opacity: 1; }
.player-list li {
  padding: 8px 2px;
  border-bottom: 1px solid rgba(232, 230, 217, .1);
  display: flex;
  justify-content: space-between;
  font-size: .95rem;
  letter-spacing: .04em;
}
.player-list .tag { color: var(--gold); font-size: .72rem; letter-spacing: .2em; }

.strips {
  flex: 1;
  display: flex;
  gap: 7px;
  min-width: 0;
}
.strip {
  position: relative;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  border-radius: 5px;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .07);
  filter: grayscale(.65) brightness(.5);
  transition: flex .4s cubic-bezier(.25,.8,.3,1), filter .3s, border-color .3s, box-shadow .3s;
  background: rgba(255, 255, 255, .03);
}
.strip:hover { flex: 1.9; filter: grayscale(0) brightness(1); }
.strip.selected {
  flex: 1.7;
  filter: none;
  border-color: var(--gold);
  box-shadow: 0 0 26px rgba(207, 169, 79, .25), inset 0 0 0 1px rgba(207, 169, 79, .5);
}
.strip canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.strip::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(5, 8, 6, 0) 50%, rgba(5, 8, 6, .88));
  pointer-events: none;
}
.strip-label {
  position: absolute;
  bottom: 22px;
  left: 0; right: 0;
  text-align: center;
  z-index: 2;
}
.strip-name {
  display: block;
  font-family: var(--serif);
  font-size: .74rem;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: #f1eee0;
  text-shadow: 0 1px 8px rgba(0, 0, 0, .9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 8px;
}
.strip-num {
  display: block;
  margin-top: 8px;
  font-family: var(--serif);
  font-size: 1.5rem;
  color: var(--gold);
}
.strip.custom { display: flex; align-items: center; justify-content: center; }
.strip.custom .plus {
  font-size: 2.6rem;
  color: var(--gold);
  z-index: 2;
  text-shadow: 0 0 20px rgba(207, 169, 79, .4);
}

.modes { display: flex; flex-direction: column; gap: 6px; }
.modes button {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  text-align: left;
  padding: 8px 12px;
  font-size: .82rem;
}
.modes button b { font-family: var(--serif); letter-spacing: .06em; font-weight: normal; }
.modes button span { color: var(--muted); font-size: .68rem; text-align: right; }
.modes button.selected { border-color: var(--gold); box-shadow: inset 0 0 0 1px rgba(207, 169, 79, .5); }
.modes button.selected b { color: var(--gold-bright); }
.modes button:disabled { cursor: default; opacity: .8; }

.settings-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.settings-grid label {
  font-size: .8rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
  letter-spacing: .05em;
}
.settings-grid output { color: var(--gold-bright); font-family: var(--serif); }
.settings-grid input[type=range] { width: 100%; accent-color: var(--gold); }
.settings-grid.locked { pointer-events: none; opacity: .5; }

/* ---------- oyun ---------- */
#screen-game { background: #040705; }
#game-canvas { position: absolute; inset: 0; margin: auto; image-rendering: auto; }

#hud { position: absolute; top: 0; left: 0; right: 0; pointer-events: none; }
#hud-top {
  display: flex; justify-content: center; gap: 26px; padding: 12px;
  font-size: 1rem; letter-spacing: .05em;
  color: #f1eee0;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .9);
}
#hud-timer { color: var(--gold-bright); font-family: var(--serif); font-size: 1.35rem; }
#hud-timer.low { color: #ff8b7a; animation: timer-pulse 1s infinite; }
@keyframes timer-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}
#btn-music {
  position: absolute;
  top: 10px; right: 12px;
  pointer-events: auto;
  padding: 6px 10px;
  font-size: 1rem;
  background: rgba(9, 15, 11, .6);
}

.overlay {
  position: absolute; inset: 0;
  background: rgba(4, 7, 5, .82);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  z-index: 10;
}
.overlay-passthrough {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none; z-index: 9;
}
.panel.center { text-align: center; max-width: 480px; }
.panel.center p { margin: 10px 0; }
.panel.center h2 { color: var(--gold-bright); }

#round-end-scores, #score-list { list-style: none; margin: 14px 0; text-align: left; }
#round-end-scores li, #score-list li {
  padding: 8px 12px;
  margin-bottom: 2px;
  border-bottom: 1px solid rgba(232, 230, 217, .1);
  display: flex; justify-content: space-between; min-width: 280px;
  letter-spacing: .04em;
}
#round-end-scores b, #score-list b { color: var(--gold-bright); font-family: var(--serif); }
#round-end-scores li:first-child {
  background: rgba(207, 169, 79, .1);
  border: 1px solid var(--hairline);
  border-radius: 4px;
}

/* ---------- tuş ipuçları çubuğu ---------- */
#tips {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 8px 16px;
  z-index: 4;
  font-size: .82rem;
  color: var(--text);
  letter-spacing: .03em;
  backdrop-filter: blur(4px);
  white-space: nowrap;
  max-width: 96vw;
  overflow-x: auto;
}
.tip-sep { color: var(--muted); margin: 0 10px; }

/* özel görsel yeniden seçme */
#btn-repick {
  position: absolute;
  top: 10px; right: 10px;
  z-index: 3;
  padding: 5px 9px;
  background: rgba(9, 15, 11, .7);
}

/* ---------- boyama araç çubuğu (alt-orta) ---------- */
#tools {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 10px 16px;
  z-index: 5;
  backdrop-filter: blur(4px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .6);
  max-width: 94vw;
  flex-wrap: wrap;
  justify-content: center;
}
.swatches { display: flex; gap: 5px; }
.swatch {
  width: 20px; height: 20px;
  padding: 0;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, .25);
  cursor: pointer;
}
.swatch:hover { transform: scale(1.15); border-color: #fff; }
#cur-color {
  width: 26px; height: 26px;
  border-radius: 6px;
  background: #fff;
  border: 2px solid var(--gold);
  flex-shrink: 0;
}
.tool-slider {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: .62rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--muted);
}
.tool-slider input[type=range] { width: 84px; accent-color: var(--gold); }
.tool-group { display: flex; gap: 5px; }
.tool-group button { padding: 6px 9px; font-size: .9rem; }
#btn-ready { padding: 8px 18px; }
.tool-hint {
  flex-basis: 100%;
  text-align: center;
  color: var(--muted);
  font-size: .68rem;
  letter-spacing: .04em;
}

/* ---------- sohbet ---------- */
#chat {
  position: absolute;
  left: 14px; bottom: 66px;
  width: 250px;
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#chat-list { list-style: none; display: flex; flex-direction: column; gap: 3px; }
#chat-list li {
  background: rgba(9, 15, 11, .78);
  border: 1px solid rgba(232, 230, 217, .1);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: .8rem;
  letter-spacing: .02em;
  transition: opacity 1.2s;
  word-break: break-word;
}
#chat-list li b { color: var(--gold-bright); font-weight: normal; font-family: var(--serif); }
#chat-list li.old { opacity: .35; }
#chat-input {
  background: rgba(9, 15, 11, .78);
  border: 1px solid rgba(232, 230, 217, .15);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: .8rem;
  width: 100%;
}
#chat-input:focus { border-color: var(--gold); }

#toasts { position: fixed; bottom: 16px; right: 16px; z-index: 50; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--panel-solid);
  color: var(--text);
  border: 1px solid rgba(232, 230, 217, .12);
  border-left: 3px solid var(--gold);
  padding: 11px 16px;
  border-radius: 5px;
  animation: toast-in .25s ease, toast-out .4s ease 3.6s forwards;
  max-width: 320px;
  font-size: .88rem;
  letter-spacing: .03em;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .55);
}
.toast.bad { border-left-color: var(--danger); }
@keyframes toast-in { from { transform: translateX(120%); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px); } }
