:root {
  --cream: #fff8f0;
  --cream-dark: #ffeedd;
  --mint: #e6f7f2;
  --teal: #0d9488;
  --teal-dark: #0f766e;
  --teal-soft: #ccfbf1;
  --coral: #f97316;
  --coral-soft: #ffedd5;
  --violet: #7c3aed;
  --ink: #1e293b;
  --ink-soft: #475569;
  --white: #ffffff;
  --ok: #16a34a;
  --ok-bg: #dcfce7;
  --bad: #dc2626;
  --bad-bg: #fee2e2;
  --radius: 1.25rem;
  --radius-sm: 0.75rem;
  --shadow: 0 10px 40px -12px rgba(15, 118, 110, 0.2);
  --shadow-card: 0 4px 20px rgba(30, 41, 59, 0.06);
  font-family: "Nunito", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  line-height: 1.55;
  background: linear-gradient(165deg, var(--cream) 0%, var(--mint) 45%, var(--cream-dark) 100%);
  position: relative;
}

.page-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 12% 18%, rgba(13, 148, 136, 0.12) 0%, transparent 42%),
    radial-gradient(circle at 88% 8%, rgba(124, 58, 237, 0.08) 0%, transparent 38%),
    radial-gradient(circle at 70% 85%, rgba(249, 115, 22, 0.09) 0%, transparent 45%);
  z-index: 0;
}

.header {
  position: relative;
  z-index: 1;
  padding: 1.75rem 1.25rem 1.5rem;
}

.header__inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.header__text {
  max-width: 36rem;
}

.header__badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--teal-dark);
  background: var(--white);
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  box-shadow: 0 2px 10px rgba(13, 148, 136, 0.15);
  margin-bottom: 0.6rem;
}

.header__title {
  margin: 0;
  font-size: clamp(1.75rem, 4.5vw, 2.35rem);
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.header__subtitle {
  margin: 0.65rem 0 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink-soft);
  max-width: 32ch;
}

.header__deco {
  position: relative;
  width: 120px;
  height: 100px;
  flex-shrink: 0;
}

.header__spark {
  position: absolute;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--coral-soft), var(--white));
  border: 3px solid var(--white);
  box-shadow: var(--shadow-card);
  top: 8px;
  right: 20px;
}

.header__spark--2 {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--teal-soft), var(--white));
  top: 48px;
  right: 0;
  border-width: 2px;
}

.header__spark--3 {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #ede9fe, var(--white));
  top: 0;
  right: 56px;
  border-width: 2px;
}

.layout {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1rem 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.layout__mid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 900px) {
  .layout__mid {
    grid-template-columns: 1.15fr 1fr;
    align-items: start;
  }
}

.layout__side {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.panel {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(13, 148, 136, 0.1);
}

.panel__title {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--teal-dark);
}

.panel__title--center {
  text-align: center;
  margin-bottom: 0.35rem;
}

.panel__lead {
  text-align: center;
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink-soft);
  max-width: 26ch;
  margin-left: auto;
  margin-right: auto;
}

.panel--wheel-hero {
  background: linear-gradient(180deg, var(--white) 0%, #f0fdfa 100%);
}

.panel__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.sira {
  margin: 0;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--coral);
  background: var(--coral-soft);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 0.75rem;
}

.score-card {
  border-radius: var(--radius-sm);
  padding: 0.85rem 0.95rem;
  background: linear-gradient(135deg, #fafafa 0%, var(--white) 100%);
  border: 2px solid rgba(148, 163, 184, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.score-card:hover {
  transform: translateY(-1px);
}

.score-card--current {
  border-color: var(--teal);
  background: linear-gradient(135deg, var(--teal-soft) 0%, var(--white) 100%);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.2);
}

.score-card__name {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
  word-break: break-word;
  color: var(--ink);
}

.score-card__pts {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--coral);
}

.match-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink-soft);
  flex: 1;
  min-width: 200px;
}

.field input {
  padding: 0.6rem 0.75rem;
  border: 2px solid rgba(148, 163, 184, 0.35);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  font-weight: 600;
  transition: border-color 0.15s;
}

.field input:focus {
  outline: none;
  border-color: var(--teal);
}

.team-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.team-row input[type="text"] {
  flex: 1;
  min-width: 160px;
  padding: 0.5rem 0.65rem;
  border: 2px solid rgba(148, 163, 184, 0.35);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-weight: 600;
}

.team-row input[type="text"]:focus {
  outline: none;
  border-color: var(--teal);
}

.btn {
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.55rem 1.1rem;
  transition: transform 0.1s ease, box-shadow 0.15s ease, background 0.15s;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn--primary {
  background: linear-gradient(180deg, var(--teal) 0%, var(--teal-dark) 100%);
  color: var(--white);
  box-shadow: 0 4px 14px rgba(13, 148, 136, 0.35);
}

.btn--primary:hover:not(:disabled) {
  box-shadow: 0 6px 20px rgba(13, 148, 136, 0.4);
}

.btn--secondary {
  background: #f1f5f9;
  color: var(--ink);
}

.btn--secondary:hover:not(:disabled) {
  background: #e2e8f0;
}

.btn--small {
  padding: 0.4rem 0.85rem;
  font-size: 0.88rem;
  background: linear-gradient(180deg, var(--violet) 0%, #6d28d9 100%);
  color: var(--white);
  box-shadow: 0 3px 12px rgba(124, 58, 237, 0.3);
}

.btn--small:hover:not(:disabled) {
  box-shadow: 0 5px 16px rgba(124, 58, 237, 0.35);
}

.btn--danger {
  background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
  color: var(--white);
  padding: 0.4rem 0.65rem;
  font-size: 0.85rem;
}

.btn--danger:hover:not(:disabled) {
  filter: brightness(1.05);
}

.btn--spin {
  margin-top: 0.85rem;
  width: 100%;
  max-width: 300px;
  font-size: 1.15rem;
  padding: 0.85rem 1.25rem;
  border-radius: 999px;
}

.panel--wheel {
  text-align: center;
}

.wheel-wrap {
  position: relative;
  display: inline-block;
  margin: 0.75rem auto;
}

#cark-canvas {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 50%;
  box-shadow:
    0 12px 40px rgba(13, 148, 136, 0.25),
    0 0 0 6px var(--white),
    0 0 0 8px rgba(13, 148, 136, 0.15);
}

.wheel-pointer {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 16px solid transparent;
  border-right: 16px solid transparent;
  border-top: 26px solid var(--coral);
  z-index: 2;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.15));
}

.sonuc {
  min-height: 1.5em;
  font-weight: 800;
  margin: 0.65rem 0 0;
  font-size: 1.05rem;
  color: var(--teal-dark);
}

.muted {
  color: var(--ink-soft);
  font-size: 0.92rem;
  margin: 0 0 0.5rem;
  font-weight: 600;
}

.panel--history {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto 2rem;
  width: calc(100% - 2rem);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.85rem;
}

.history-item {
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.4rem 0.85rem;
  align-items: start;
  background: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.history-item input[type="text"] {
  width: 100%;
  padding: 0.45rem 0.55rem;
  border: 2px solid rgba(148, 163, 184, 0.3);
  border-radius: 8px;
  font-weight: 700;
  font-family: inherit;
}

.history-item__meta {
  grid-column: 1 / -1;
  font-size: 0.82rem;
  color: var(--ink-soft);
  font-weight: 600;
}

.history-item__scores {
  font-size: 0.9rem;
  font-weight: 700;
}

.history-item__actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
}

.modal[hidden] {
  display: none !important;
}

.modal__box {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem 1.35rem;
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  box-shadow: var(--shadow);
  border: 1px solid rgba(13, 148, 136, 0.12);
}

.modal__box--wide {
  max-width: 640px;
}

.modal__title {
  margin: 0 0 0.75rem;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--teal-dark);
}

.modal__intro {
  margin: 0 0 0.75rem;
  font-weight: 600;
  color: var(--ink-soft);
  font-size: 0.98rem;
}

.modal__meta {
  font-size: 0.88rem;
  color: var(--ink-soft);
  margin: 0 0 0.5rem;
  font-weight: 700;
}

.modal__text {
  margin: 0 0 1.1rem;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.5;
}

.secenekler {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.secenek-btn {
  text-align: left;
  padding: 0.75rem 1rem;
  border: 2px solid rgba(148, 163, 184, 0.35);
  border-radius: var(--radius-sm);
  background: var(--white);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}

.secenek-btn:hover:not(:disabled) {
  border-color: var(--teal);
  background: var(--teal-soft);
}

.secenek-btn:active:not(:disabled) {
  transform: scale(0.99);
}

.secenek-btn:disabled {
  cursor: default;
  opacity: 0.92;
}

.secenek-btn--dogru {
  border-color: var(--ok);
  background: var(--ok-bg);
}

.secenek-btn--yanlis {
  border-color: var(--bad);
  background: var(--bad-bg);
}

.modal__sure {
  font-size: 1.1rem;
  font-weight: 800;
  margin: 0 0 0.65rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--teal-soft);
  color: var(--teal-dark);
  border: 2px solid rgba(13, 148, 136, 0.25);
}

.modal__sure--acil {
  background: #fff7ed;
  color: #c2410c;
  border-color: #fb923c;
  animation: modal-sure-pulse 0.9s ease-in-out infinite;
}

.modal__sure--bitti {
  background: #f1f5f9;
  color: var(--ink-soft);
  border-color: rgba(148, 163, 184, 0.4);
  animation: none;
}

@keyframes modal-sure-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.88;
  }
}

@media (prefers-reduced-motion: reduce) {
  .modal__sure--acil {
    animation: none;
  }
}

.modal__feedback {
  min-height: 1.35em;
  font-weight: 800;
  margin: 0.85rem 0;
  font-size: 1.05rem;
}

.pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 0.55rem;
  margin: 1rem 0;
}

.pick-grid button {
  padding: 0.65rem;
  font: inherit;
  font-weight: 800;
  border: 2px solid rgba(148, 163, 184, 0.35);
  border-radius: var(--radius-sm);
  background: var(--white);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.pick-grid button:hover {
  border-color: var(--coral);
  background: var(--coral-soft);
}

.toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--white);
  padding: 0.75rem 1.25rem;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 700;
  z-index: 1100;
  box-shadow: var(--shadow);
}

.toast[hidden] {
  display: none !important;
}

@media (max-width: 520px) {
  .history-item {
    grid-template-columns: 1fr;
  }

  .header__deco {
    display: none;
  }
}
