:root {
  --bg: #0b1724;
  --panel: #101d2d;
  --accent-x: #ff8a5c;
  --accent-o: #4dd4ff;
  --text: #e9f1fb;
  --muted: #9bb1c9;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
}

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

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 20% 20%, rgba(77, 212, 255, 0.08), transparent 35%),
    radial-gradient(circle at 80% 0%, rgba(255, 138, 92, 0.08), transparent 40%),
    var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(11, 23, 36, 0.95);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal__content {
  width: min(380px, 90vw);
  background: linear-gradient(145deg, #0e1c2c, #0b1622);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  padding: 32px 28px;
  box-shadow: var(--shadow);
  animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal__title {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  color: var(--text);
}

.modal__subtitle {
  margin: 0 0 28px;
  font-size: 20px;
  text-align: center;
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.modal__form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal__input {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.modal__input:focus {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
}

.modal__input::placeholder {
  color: var(--muted);
}

.button--full {
  width: 100%;
  margin-top: 4px;
}

.modal__separator {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 8px 0;
}

.separator__dot {
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.button--link {
  background: transparent;
  border: none;
  box-shadow: none;
  color: var(--muted);
  font-weight: 500;
  padding: 8px;
  margin-top: 4px;
}

.button--link:hover {
  color: var(--text);
  transform: none;
  box-shadow: none;
}

/* Toast/Popup Message */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast__content {
  background: linear-gradient(145deg, #0e1c2c, #0b1622);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 16px 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  color: var(--text);
  font-weight: 600;
  font-size: 16px;
  white-space: nowrap;
  animation: toastSlide 0.3s ease-out;
}

@keyframes toastSlide {
  from {
    transform: translateY(-10px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.app {
  width: min(420px, 92vw);
  background: linear-gradient(145deg, #0e1c2c, #0b1622);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 18px;
  padding: 22px 20px 18px;
  box-shadow: var(--shadow);
}

.app__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.title__emoji {
  font-size: 28px;
}

.title__eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 11px;
  color: var(--muted);
}

.title__text {
  margin: 2px 0 0;
  font-size: 26px;
  letter-spacing: -0.5px;
}

.status {
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
}

.board-container {
  position: relative;
}

.board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: var(--panel);
  border-radius: 14px;
  padding: 10px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  position: relative;
}

.win-line {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
  overflow: visible;
}

.win-line line {
  stroke: var(--text);
  stroke-width: 4;
  stroke-linecap: round;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.4));
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: drawLine 0.8s ease-out forwards;
}

@keyframes drawLine {
  to {
    stroke-dashoffset: 0;
  }
}

.cell {
  aspect-ratio: 1 / 1;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  display: grid;
  place-items: center;
  font-size: clamp(34px, 7vw, 48px);
  font-weight: 800;
  color: var(--text);
  cursor: pointer;
  transition: transform 120ms ease, background 140ms ease, border 140ms ease, opacity 140ms ease;
  user-select: none;
}

.cell:hover:not(.cell--finished):not([disabled]) {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.04);
}

.cell:active:not(.cell--finished):not([disabled]) {
  transform: translateY(0);
}

.cell--finished {
  cursor: not-allowed;
  opacity: 0.8;
}

.cell--finished:not(.cell--win) {
  opacity: 0.6;
}

.cell--x {
  color: var(--accent-x);
}

.cell--o {
  color: var(--accent-o);
}

.cell--win {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2), 0 0 20px rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.08);
  animation: winPulse 1s ease-in-out infinite;
}

@keyframes winPulse {
  0%, 100% {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2), 0 0 20px rgba(255, 255, 255, 0.1);
  }
  50% {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3), 0 0 30px rgba(255, 255, 255, 0.15);
  }
}

.controls {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.credit {
    
    margin-top: 40px;
    text-align: center;
    
    
}

.button {
  background: linear-gradient(135deg, #1c2f45, #152538);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 140ms ease;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.3);
}

.button:active {
  transform: translateY(0);
}

@media (max-width: 520px) {
  .title__text {
    font-size: 22px;
  }

  .status {
    font-size: 13px;
  }
}
