/* NAVY Wheel — design system по мотивам documents-web
   Токены: Inter, #1A1F29/#414A5C/#7F8899, акцент #128CFC, радиусы 12/24/32 */

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

:root {
  --text:         #1A1F29;
  --text-2:       #414A5C;
  --muted:        #7F8899;
  --blue:         #128CFC;
  --blue-bright:  #128CFC;
  --blue-soft:    rgba(0, 133, 255, 0.15);
  --neutral-btn:  rgba(28, 50, 92, 0.07);
  --neutral-hover: rgba(28, 50, 92, 0.12);
  --card:         #FFFFFF;
  --dash:         #B2DAFF;
  --dash-bg:      rgba(0, 133, 255, 0.04);
  --grad-cta:     linear-gradient(85deg, #9B4EC7 0%, #3C64F4 100%);
  --bg:           linear-gradient(180deg, #E0F0FF 0%, #F6F9FB 55%, #E5F3FF 100%);
  --overlay:      rgba(26, 31, 41, 0.35);
  --input-border: #E3EBF3;
  --toast-bg:     #1A1F29;
  --toast-fg:     #FFFFFF;
  --log-host:     #128CFC;
  --log-prize:    #9C79EC;
  --log-mystery:  #E65DBD;
  --log-shield:   #25ACDD;
  --tag-shield-bg: rgba(37, 172, 221, 0.15);
  --tag-shield-fg: #1897C6;
  --tag-cd-bg:    rgba(156, 121, 236, 0.15);
  --tag-cd-fg:    #7B5BD6;
  --tag-out-bg:   rgba(127, 136, 153, 0.15);
  --danger-bg:    rgba(226, 78, 131, 0.12);
  --danger-fg:    #E24E83;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 24px;
  --r-xl: 32px;
}

html[data-theme="dark"] {
  --text:         #E8EDF4;
  --text-2:       #AEB9C9;
  --muted:        #7A8698;
  --blue:         #128CFC;
  --blue-bright:  #4DA8FF;
  --blue-soft:    rgba(45, 138, 235, 0.20);
  --neutral-btn:  rgba(173, 200, 235, 0.10);
  --neutral-hover: rgba(173, 200, 235, 0.17);
  --card:         #141E2E;
  --dash:         #2A4A6E;
  --dash-bg:      rgba(45, 138, 235, 0.08);
  --bg:           linear-gradient(180deg, #0A111C 0%, #0E1727 55%, #0B1320 100%);
  --overlay:      rgba(2, 6, 12, 0.55);
  --input-border: #263349;
  --toast-bg:     #E8EDF4;
  --toast-fg:     #101826;
  --log-host:     #4DA8FF;
  --log-prize:    #B79AF5;
  --log-mystery:  #F07BC9;
  --log-shield:   #4FC3E8;
  --tag-shield-bg: rgba(79, 195, 232, 0.16);
  --tag-shield-fg: #4FC3E8;
  --tag-cd-bg:    rgba(183, 154, 245, 0.16);
  --tag-cd-fg:    #B79AF5;
  --tag-out-bg:   rgba(127, 136, 153, 0.20);
  --danger-bg:    rgba(240, 110, 150, 0.14);
  --danger-fg:    #F06E96;
}

html, body { height: 100%; }

* { scrollbar-width: thin; scrollbar-color: var(--dash) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--dash); border-radius: 4px; }
*::-webkit-scrollbar-track { background: transparent; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
}

/* ── Header ─────────────────────────────────────────────── */

.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 28px;
}
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; color: var(--text); }
.brand-name { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.brand-sub  { font-size: 12px; color: var(--muted); font-weight: 500; }
.topbar-spacer { flex: 1; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; cursor: pointer; text-decoration: none;
  font-family: inherit; font-size: 14px; font-weight: 500;
  height: 36px; padding: 0 14px; border-radius: var(--r-sm);
  background: var(--neutral-btn); color: var(--text);
  transition: background .15s, box-shadow .3s, transform .1s;
  white-space: nowrap;
}
.btn:hover { background: var(--neutral-hover); }
.btn:active { transform: scale(0.98); }

.btn-primary { background: var(--blue); color: #fff; height: 48px; padding: 0 24px; border-radius: var(--r-md); font-size: 16px; }
.btn-primary:hover { background: #0f7de3; }
.btn-soft { background: var(--blue-soft); color: var(--blue); }
.btn-soft:hover { background: rgba(0, 133, 255, 0.24); }
.btn-cta {
  background: var(--grad-cta); color: #fff;
  height: 48px; padding: 0 24px; border-radius: var(--r-md); font-size: 16px;
}
.btn-cta:hover { box-shadow: 0 0 12px rgba(155, 78, 199, 0.4); }
.btn-danger { background: var(--danger-bg); color: var(--danger-fg); }
.btn-danger:hover { background: var(--danger-bg); filter: brightness(1.15); }
.btn-lg { height: 56px; padding: 0 32px; border-radius: var(--r-md); font-size: 16px; }

.identity-badge {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: var(--r-sm);
  background: var(--blue-soft); color: var(--blue);
  font-size: 14px; font-weight: 500; cursor: pointer; border: none; font-family: inherit;
}
.identity-badge:hover { background: rgba(0, 133, 255, 0.24); }

/* ── Layout ─────────────────────────────────────────────── */

.layout {
  display: grid;
  grid-template-columns: 300px 1fr 330px;
  gap: 20px;
  padding: 8px 28px 28px;
  max-width: 1720px;
  margin: 0 auto;
  align-items: stretch;
  height: calc(100vh - 76px); /* колонки одной высоты, во весь экран */
  min-height: 560px;
}
.layout > .card { display: flex; flex-direction: column; min-height: 0; }

.card {
  background: var(--card);
  border-radius: var(--r-lg);
  padding: 20px;
}
.card-title {
  font-size: 13px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}
.card-title .spacer { flex: 1; }

/* ── Wheel ──────────────────────────────────────────────── */

.wheel-zone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  padding: 20px;
}
.wheel-wrap { position: relative; width: min(640px, 100%, calc(100vh - 260px)); }
.wheel-wrap canvas { display: block; width: 100%; height: auto; cursor: pointer; }
.wheel-hint { font-size: 14px; color: var(--muted); }

.host-banner {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: 999px;
  background: var(--blue-soft); color: var(--blue);
  font-size: 15px; font-weight: 500;
}
.host-banner b { font-weight: 700; }

/* ── Log column ─────────────────────────────────────────── */

.log-list { display: flex; flex-direction: column; gap: 2px; flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; }
.log-item { display: flex; gap: 8px; padding: 6px 8px; border-radius: var(--r-sm); font-size: 13px; line-height: 1.45; }
.log-item:hover { background: var(--dash-bg); }
.log-time { color: var(--muted); font-size: 11px; white-space: nowrap; padding-top: 2px; min-width: 68px; }
.log-text { flex: 1; color: var(--text-2); overflow-wrap: anywhere; }
.log-host    .log-text { color: var(--log-host); font-weight: 500; }
.log-prize   .log-text { color: var(--log-prize); }
.log-mystery .log-text { color: var(--log-mystery); }
.log-shield  .log-text { color: var(--log-shield); }
.log-absent  .log-text, .log-edit .log-text { color: var(--muted); }
.log-day { justify-content: center; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; padding: 10px 0 4px; }
.log-day .log-text { color: var(--muted); text-align: center; flex: none; }

/* ── Team panel ─────────────────────────────────────────── */

.team-list { display: flex; flex-direction: column; gap: 4px; flex: 1; min-height: 0; overflow-y: auto; }
.team-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--r-md);
}
.team-row:hover { background: var(--dash-bg); }
.team-row.is-out { opacity: 0.45; }
.team-name { font-size: 14px; font-weight: 500; flex: 1; display: flex; align-items: center; gap: 7px; min-width: 0; }
.team-name span.nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag {
  font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 999px; white-space: nowrap;
}
.tag-host     { background: var(--tag-cd-bg); color: var(--tag-cd-fg); }
.team-row.is-host { background: var(--dash-bg); }
.tag-shield   { background: var(--tag-shield-bg); color: var(--tag-shield-fg); }
.tag-cooldown { background: var(--tag-cd-bg); color: var(--tag-cd-fg); }
.tag-out      { background: var(--tag-out-bg); color: var(--muted); }
.team-stat { font-size: 12px; color: var(--muted); white-space: nowrap; text-align: right; line-height: 1.4; }

/* ── Modal ──────────────────────────────────────────────── */

.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: var(--overlay);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.overlay.show { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--card); border-radius: var(--r-lg);
  padding: 36px; width: min(460px, calc(100vw - 40px));
  max-height: calc(100vh - 80px); overflow-y: auto;
  text-align: center;
  transform: translateY(12px) scale(0.97); transition: transform .2s;
}
.overlay.show .modal { transform: none; }
.modal-emoji { font-size: 56px; line-height: 1; margin-bottom: 14px; }
.modal-title { font-size: 26px; font-weight: 800; letter-spacing: -0.01em; margin-bottom: 8px; }
.modal-sub   { font-size: 15px; color: var(--text-2); margin-bottom: 24px; line-height: 1.5; }
.modal-actions { display: flex; flex-direction: column; gap: 10px; }
.modal-actions .btn { width: 100%; height: 48px; border-radius: var(--r-md); font-size: 15px; }
.modal-cancel { margin-top: 6px; background: none; color: var(--muted); font-size: 13px; height: 32px; }
.modal-cancel:hover { background: none; color: var(--text-2); }

.pick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.pick-grid .btn { height: 46px; border-radius: var(--r-md); font-size: 14px; justify-content: flex-start; padding: 0 16px; }

/* mystery box */
.mystery-box { font-size: 88px; line-height: 1; margin: 10px 0 20px; display: inline-block; }
.mystery-box.shaking { animation: boxshake 1.4s ease-in-out; }
@keyframes boxshake {
  0%, 100% { transform: rotate(0); }
  10% { transform: rotate(-8deg) scale(1.02); } 20% { transform: rotate(8deg); }
  30% { transform: rotate(-10deg) scale(1.05); } 40% { transform: rotate(10deg); }
  50% { transform: rotate(-6deg) scale(1.08); } 60% { transform: rotate(6deg); }
  70% { transform: rotate(-3deg) scale(1.1); } 80% { transform: rotate(3deg) scale(1.12); }
  90% { transform: rotate(-1deg) scale(1.15); }
}

/* ── Winner banner ──────────────────────────────────────── */

.winner-pulse { animation: winnerpulse 0.6s ease-out; }
@keyframes winnerpulse { 0% { transform: scale(0.6); opacity: 0; } 60% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }

/* ── Settings page ──────────────────────────────────────── */

.settings-layout {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
  padding: 8px 28px 28px; max-width: 1280px; margin: 0 auto; align-items: start;
}
.settings-col { display: flex; flex-direction: column; gap: 20px; }

.row-list { display: flex; flex-direction: column; gap: 4px; }
.edit-row { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: var(--r-md); }
.edit-row:hover { background: var(--dash-bg); }
.edit-row input[type="text"] {
  flex: 1; min-width: 0; border: none; background: none; font-family: inherit; font-size: 14px;
  color: var(--text); padding: 6px 8px; border-radius: var(--r-sm); outline: none;
}
.edit-row input[type="text"]:focus { background: var(--card); box-shadow: 0 0 0 2px var(--dash); }
.edit-row select {
  border: none; background: var(--neutral-btn); font-family: inherit; font-size: 12px;
  color: var(--text-2); padding: 5px 8px; border-radius: var(--r-sm); outline: none; cursor: pointer;
}
.w-ctl { display: flex; align-items: center; gap: 2px; }
.w-btn {
  width: 22px; height: 22px; border: none; border-radius: 6px; background: var(--neutral-btn);
  color: var(--text-2); font-size: 13px; cursor: pointer; line-height: 1; font-family: inherit;
}
.w-btn:hover { background: var(--neutral-hover); }
.w-val { font-size: 12px; font-weight: 600; color: var(--text-2); min-width: 34px; text-align: center; }
.del-btn {
  width: 26px; height: 26px; border: none; border-radius: 7px; background: none;
  color: var(--muted); font-size: 15px; cursor: pointer; font-family: inherit;
}
.del-btn:hover { background: var(--danger-bg); color: var(--danger-fg); }

.add-row { display: flex; gap: 8px; margin-top: 10px; }
.add-row input {
  flex: 1; min-width: 0; height: 40px; border: 2px dashed var(--dash); background: var(--dash-bg);
  border-radius: var(--r-md); padding: 0 14px; font-family: inherit; font-size: 14px; color: var(--text); outline: none;
}
.add-row input:focus { border-style: solid; background: var(--card); }
.add-row select { border: none; background: var(--neutral-btn); font-family: inherit; font-size: 13px; color: var(--text-2); padding: 0 10px; border-radius: var(--r-md); outline: none; cursor: pointer; }
.add-row .btn { height: 40px; border-radius: var(--r-md); }

.mech-row { display: flex; align-items: center; gap: 12px; padding: 8px 6px; font-size: 14px; color: var(--text-2); }
.mech-row label { flex: 1; }
.mech-row input[type="number"] {
  width: 80px; height: 36px; border: 1px solid var(--input-border); border-radius: var(--r-sm); background: var(--card);
  padding: 0 10px; font-family: inherit; font-size: 14px; color: var(--text); outline: none; text-align: center;
}
.mech-row input[type="number"]:focus { border-color: var(--dash); }

.rules { font-size: 14px; color: var(--text-2); line-height: 1.65; }
.rules h4 { font-size: 14px; color: var(--text); margin: 14px 0 4px; }
.rules ul { padding-left: 20px; }
.rules li { margin: 3px 0; }
.rules .mini { font-size: 12px; color: var(--muted); }

.changelog { font-size: 13px; color: var(--text-2); line-height: 1.6; }
.changelog .ver { font-weight: 700; color: var(--text); margin-top: 10px; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--toast-bg); color: var(--toast-fg); font-size: 14px; padding: 12px 22px;
  border-radius: var(--r-md); z-index: 60; transition: transform .25s; pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ── Responsive ─────────────────────────────────────────── */

@media (max-width: 1200px) {
  .layout { grid-template-columns: 1fr 320px; height: auto; }
  .log-card { grid-column: 1 / -1; order: 3; }
  .log-list { max-height: 300px; }
  .team-list { max-height: 420px; }
}
@media (max-width: 860px) {
  .layout, .settings-layout { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; }
}
