:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --line: #dfe3ec;
  --text: #1b1f2a;
  --muted: #6b7280;
  --accent: #3369e8;
  --accent-dark: #2452c0;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .08);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  font: 15px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ------------------------------------------------------------- üst bar */

.topbar {
  flex: none;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 17px;
  letter-spacing: -.01em;
}

.brand b { font-weight: 700; }

.brand-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: conic-gradient(#3369e8 0 25%, #009925 0 50%, #fbbc05 0 75%, #d50f25 0);
}

.actions { display: flex; gap: 4px; }

button {
  font: inherit;
  cursor: pointer;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: background .12s, border-color .12s;
}

.ghost {
  background: transparent;
  color: var(--muted);
  padding: 7px 12px;
}
.ghost:hover { background: #eef1f7; color: var(--text); }

.primary {
  background: var(--accent);
  color: #fff;
  padding: 8px 18px;
  font-weight: 600;
}
.primary:hover { background: var(--accent-dark); }

/* ------------------------------------------------------------- yerleşim */

.layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 420px;
}

.stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  background:
    radial-gradient(1100px 700px at 30% 25%, #ffffff 0%, #eef2fb 45%, #f7eef2 100%);
}

#wheel {
  width: 100%;
  height: 100%;
  display: block;
  cursor: pointer;
  touch-action: manipulation;
}

.confetti {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hint {
  position: absolute;
  bottom: 14px;
  left: 0;
  right: 0;
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  pointer-events: none;
  transition: opacity .25s;
}
.hint.gone { opacity: 0; }

/* ------------------------------------------------------------- yan panel */

.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel);
  border-left: 1px solid var(--line);
}

.tabs {
  flex: none;
  display: flex;
  gap: 2px;
  padding: 8px 12px 0;
  border-bottom: 1px solid var(--line);
}

.tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 8px 14px;
  color: var(--muted);
}
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.badge {
  display: inline-block;
  min-width: 18px;
  padding: 0 5px;
  margin-left: 4px;
  border-radius: 9px;
  background: #e7ebf3;
  color: var(--muted);
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}

.tabpane {
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  padding: 10px 12px 12px;
  gap: 10px;
}
.tabpane.active { display: flex; }

.toolbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.tool {
  background: var(--accent);
  color: #fff;
  padding: 6px 12px;
  font-size: 13px;
}
.tool:hover { background: var(--accent-dark); }

.check {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}

.mini {
  padding: 4px 6px;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  cursor: pointer;
}
.mini:focus { border-color: var(--accent); }

#entries {
  flex: 1;
  min-height: 0;
  resize: none;
  padding: 12px;
  font: 14px/1.6 ui-monospace, "Cascadia Mono", Consolas, monospace;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
}
#entries:focus { border-color: var(--accent); }

.panel-foot {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
}

.name-input, .field {
  flex: 1;
  padding: 8px 10px;
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: #fff;
  color: var(--text);
}
.name-input:focus, .field:focus { border-color: var(--accent); }

.status { font-size: 12px; color: var(--muted); white-space: nowrap; }

.results {
  flex: 1;
  min-height: 0;
  overflow: auto;
  list-style: none;
  margin: 0;
  padding: 0;
}

.results li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
}
.results li b { font-weight: 600; }
.results li span { color: var(--muted); font-size: 12px; white-space: nowrap; }
.results .empty { justify-content: center; color: var(--muted); border: none; }

/* ------------------------------------------------------------- modallar */

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 20, 35, .45);
  z-index: 50;
}
.modal[hidden] { display: none; }

.modal-card {
  width: min(420px, calc(100vw - 32px));
  padding: 26px;
  background: var(--panel);
  border-radius: 14px;
  box-shadow: var(--shadow);
  text-align: center;
  animation: pop .18s ease-out;
}
.modal-card.wide { width: min(560px, calc(100vw - 32px)); text-align: left; }

@keyframes pop {
  from { transform: scale(.94); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-label {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

.modal-card h2 {
  margin: 0 0 22px;
  font-size: 40px;
  line-height: 1.15;
  word-break: break-word;
}

.modal-card .field { display: block; width: 100%; margin-bottom: 10px; }

.survivor {
  margin: -12px 0 4px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #eef4ff;
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 600;
}
.survivor[hidden] { display: none; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.rig-msg { margin: 4px 0 0; font-size: 12px; color: var(--muted); min-height: 16px; }

.wheel-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 50vh;
  overflow: auto;
}
.wheel-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}
.wheel-list button { padding: 5px 10px; font-size: 13px; }
.wheel-list .meta { color: var(--muted); font-size: 12px; }

@media (max-width: 900px) {
  body { overflow: auto; }
  .layout { grid-template-columns: 1fr; }
  .stage { height: 62vh; }
  .panel { border-left: none; border-top: 1px solid var(--line); height: 60vh; }
}
