:root {
  color-scheme: dark;
  --bg: #100d16;
  --panel: rgba(31, 26, 40, .82);
  --panel-border: rgba(255, 255, 255, .09);
  --text: #f6f1fa;
  --muted: #aaa0b5;
  --pink: #f49bb5;
  --pink-strong: #e86f9b;
  --violet: #9c7bd8;
  --square-light: #e7d8dc;
  --square-dark: #9c6f83;
  --danger: #ed7580;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: radial-gradient(circle at 50% -10%, #2a1d37 0, var(--bg) 48%);
  color: var(--text);
  overflow-x: hidden;
}
button, input { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.aurora { position: fixed; border-radius: 50%; filter: blur(90px); opacity: .16; pointer-events: none; }
.aurora-one { width: 460px; height: 460px; background: var(--pink); top: -180px; right: -100px; }
.aurora-two { width: 380px; height: 380px; background: var(--violet); bottom: -150px; left: -100px; }

main { position: relative; min-height: 100vh; z-index: 1; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.brand-card {
  width: min(430px, 100%);
  padding: 44px;
  border: 1px solid var(--panel-border);
  border-radius: 28px;
  background: linear-gradient(145deg, rgba(39, 31, 49, .92), rgba(24, 20, 31, .88));
  box-shadow: 0 30px 90px rgba(0, 0, 0, .4);
  backdrop-filter: blur(18px);
}
.petal { width: 58px; height: 58px; display: grid; place-items: center; font-size: 30px; background: rgba(244,155,181,.12); border-radius: 18px; margin-bottom: 26px; }
.eyebrow { margin: 0 0 6px; color: var(--pink); font-size: 11px; font-weight: 800; letter-spacing: .18em; }
h1, h2 { margin: 0; letter-spacing: -.035em; }
.brand-card h1 { font-size: clamp(36px, 8vw, 52px); }
.subtitle { color: var(--muted); margin: 10px 0 30px; }
form { display: grid; gap: 18px; }
label { color: #d9d1df; font-size: 13px; font-weight: 650; }
input:not([type="range"]) {
  display: block; width: 100%; margin-top: 8px; padding: 14px 16px;
  border: 1px solid rgba(255,255,255,.10); border-radius: 12px;
  color: var(--text); background: rgba(7,6,10,.36); outline: none;
}
input:focus { border-color: var(--pink); box-shadow: 0 0 0 3px rgba(244,155,181,.12); }
.primary { border: 0; border-radius: 12px; padding: 14px 20px; color: #27131a; font-weight: 800; background: linear-gradient(135deg, #ffc0d1, var(--pink)); box-shadow: 0 10px 28px rgba(232,111,155,.18); }
.primary:hover { transform: translateY(-1px); filter: brightness(1.04); }
.error { min-height: 18px; margin: 0; color: #ff9ca4; font-size: 13px; }

.app-shell { width: min(1200px, calc(100% - 32px)); margin: 0 auto; padding: 24px 0 40px; }
header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; }
.brand { display: flex; align-items: center; gap: 13px; }
.brand-mark { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; font-size: 22px; background: rgba(244,155,181,.12); }
.brand h1 { font-size: 22px; }
.ghost, .danger { border: 1px solid var(--panel-border); color: var(--text); background: rgba(255,255,255,.045); border-radius: 10px; padding: 10px 14px; }
.ghost:hover { background: rgba(255,255,255,.08); }
.danger { color: #ffadb4; border-color: rgba(237,117,128,.22); }
.danger:disabled { opacity: .38; cursor: not-allowed; }

.layout { display: grid; grid-template-columns: minmax(420px, 700px) minmax(280px, 360px); gap: 30px; align-items: start; justify-content: center; }
.board-column { min-width: 0; }
.player-card { height: 54px; display: flex; align-items: center; gap: 11px; padding: 5px 3px; }
.player-card strong, .player-card span { display: block; }
.player-card span { color: var(--muted); font-size: 12px; margin-top: 2px; }
.avatar { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; color: #301b23; font-weight: 900; background: linear-gradient(145deg, #ffc7d7, #e589a8); }
.avatar.padik { color: #e9ddf7; background: linear-gradient(145deg, #8563b3, #4e3b70); }
.turn-indicator { width: 9px; height: 9px; border-radius: 50%; margin-left: auto !important; background: var(--pink); box-shadow: 0 0 15px var(--pink); opacity: 0; }
.turn-indicator.active { opacity: 1; }
.thinking { display: flex; gap: 4px; margin-left: auto; }
.thinking i { width: 5px; height: 5px; border-radius: 50%; background: var(--pink); animation: bounce 1s infinite; }
.thinking i:nth-child(2) { animation-delay: .15s; }.thinking i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-5px); opacity: 1; } }

.board { width: 100%; aspect-ratio: 1; display: grid; grid-template-columns: repeat(8, 1fr); overflow: hidden; border-radius: 18px; box-shadow: 0 25px 70px rgba(0,0,0,.42); border: 1px solid rgba(255,255,255,.11); user-select: none; }
.square { position: relative; display: grid; place-items: center; border: 0; padding: 0; font-family: "DejaVu Sans", "Segoe UI Symbol", sans-serif; font-size: clamp(31px, 7.1vw, 62px); line-height: 1; color: #17131d; text-shadow: 0 1px 0 rgba(255,255,255,.18); }
.square.light { background: var(--square-light); }.square.dark { background: var(--square-dark); }
.square.selected::after { content: ""; position: absolute; inset: 5px; border: 3px solid rgba(255,233,140,.95); border-radius: 8px; }
.square.target::before { content: ""; position: absolute; width: 22%; height: 22%; border-radius: 50%; background: rgba(30,23,35,.34); }
.square.capture::before { content: ""; position: absolute; inset: 6px; border: 5px solid rgba(30,23,35,.28); border-radius: 50%; }
.square.last { box-shadow: inset 0 0 0 999px rgba(255, 227, 112, .22); }
.square .coord { position: absolute; font: 700 9px/1 ui-sans-serif, system-ui; opacity: .55; }
.coord.file { right: 4px; bottom: 4px; }.coord.rank { left: 4px; top: 4px; }

.side-panel { display: grid; gap: 18px; padding-top: 54px; }
.panel { padding: 24px; border: 1px solid var(--panel-border); border-radius: 20px; background: var(--panel); box-shadow: 0 22px 60px rgba(0,0,0,.20); backdrop-filter: blur(18px); }
.panel h2 { font-size: 23px; margin-bottom: 18px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: rgba(0,0,0,.2); padding: 5px; border-radius: 12px; }
.segmented button { border: 0; border-radius: 9px; padding: 10px; color: var(--muted); background: transparent; }
.segmented button.selected { color: var(--text); background: rgba(255,255,255,.10); box-shadow: 0 4px 12px rgba(0,0,0,.18); }
.range-label { display: flex; justify-content: space-between; margin-top: 23px; }
.range-label strong { color: var(--pink); }
input[type="range"] { width: 100%; margin: 15px 0 6px; accent-color: var(--pink-strong); }
.range-scale { display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; margin-bottom: 22px; }
.panel .primary { width: 100%; }
.status-row { display: flex; align-items: center; gap: 9px; margin-bottom: 18px; }
#status-dot { width: 8px; height: 8px; border-radius: 50%; background: #756d7e; }
#status-dot.live { background: #84d3a0; box-shadow: 0 0 13px rgba(132,211,160,.7); }
.moves { height: 250px; overflow: auto; padding: 12px; border-radius: 12px; background: rgba(0,0,0,.18); }
.moves-grid { display: grid; grid-template-columns: 30px 1fr 1fr; gap: 4px 10px; font-variant-numeric: tabular-nums; }
.moves-grid span { padding: 4px 0; }.move-number { color: #756d7e; }.move { color: #ddd4e5; }
.empty { color: var(--muted); text-align: center; margin: 90px 20px 0; font-size: 13px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 16px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); padding: 12px 18px; border: 1px solid var(--panel-border); border-radius: 12px; background: #2b2434; box-shadow: 0 12px 40px rgba(0,0,0,.4); }

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 680px); }
  .side-panel { padding-top: 5px; grid-template-columns: 1fr 1fr; }
}
@media (max-width: 620px) {
  .app-shell { width: min(100% - 18px, 540px); padding-top: 13px; }
  header { margin-bottom: 10px; }.brand .eyebrow { display: none; }
  .side-panel { grid-template-columns: 1fr; }
  .board { border-radius: 10px; }
  .square { font-size: 10.8vw; }
  .panel { padding: 19px; }
  .brand-card { padding: 30px 24px; }
}

