.tt-page .game-panel { display: grid; gap: 1rem; }

.tt-ui {
  border: 1px solid rgba(132, 173, 255, 0.42);
  border-radius: 1.1rem;
  padding: 1rem;
  background:
    radial-gradient(circle at 12% 0%, rgba(255, 79, 198, .18), transparent 32%),
    radial-gradient(circle at 84% 10%, rgba(37, 236, 255, .18), transparent 30%),
    linear-gradient(160deg, rgba(39, 19, 88, .94), rgba(17, 40, 82, .9));
}

.tt-topbar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .6rem;
  align-items: center;
}

.tt-stat {
  border: 1px solid rgba(132, 173, 255, 0.42);
  border-radius: .8rem;
  background: rgba(18, 30, 77, 0.56);
  padding: .55rem .7rem;
  display: grid;
  gap: .25rem;
  text-align: center;
}

.tt-stat span {
  font-size: .72rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #e4d8ff;
}

.tt-stat strong {
  font-family: "Orbitron", system-ui, sans-serif;
  font-size: 1.02rem;
}

.tt-stat--player strong { color: #8ff1ff; }
.tt-stat--draw strong { color: #ffe57d; }
.tt-stat--cpu strong { color: #ff9fdb; }

.tt-status {
  margin: .8rem 0;
  text-align: center;
  font-family: "Orbitron", system-ui, sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: #d5d1ff;
  min-height: 2.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tt-status--win {
  color: #8ff1ff;
  text-shadow: 0 0 16px rgba(143, 241, 255, .6);
}

.tt-status--lose {
  color: #ff9fdb;
  text-shadow: 0 0 16px rgba(255, 159, 219, .6);
}

.tt-status--draw {
  color: #ffe57d;
  text-shadow: 0 0 16px rgba(255, 229, 125, .6);
}

.tt-board-wrap {
  position: relative;
  margin: .5rem auto;
  width: min(300px, calc(100vw - 3rem));
  aspect-ratio: 1 / 1;
}

.tt-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 4px;
  width: 100%;
  height: 100%;
  border-radius: .95rem;
  overflow: hidden;
  border: 2px solid rgba(132, 173, 255, 0.3);
  background: rgba(10, 16, 49, 0.6);
}

.tt-cell {
  position: relative;
  border: none;
  background: rgba(15, 22, 60, 0.7);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 180ms ease, box-shadow 180ms ease;
  -webkit-tap-highlight-color: transparent;
}

.tt-cell:hover:not(:disabled) {
  background: rgba(37, 236, 255, 0.08);
  box-shadow: inset 0 0 20px rgba(37, 236, 255, 0.06);
}

.tt-cell:active:not(:disabled) {
  background: rgba(37, 236, 255, 0.14);
}

.tt-cell:disabled {
  cursor: default;
}

.tt-cell--x {
  color: #8ff1ff;
  text-shadow: 0 0 12px rgba(143, 241, 255, .7), 0 0 28px rgba(143, 241, 255, .3);
}

.tt-cell--o {
  color: #ff9fdb;
  text-shadow: 0 0 12px rgba(255, 159, 219, .7), 0 0 28px rgba(255, 159, 219, .3);
}

.tt-cell svg {
  width: 55%;
  height: 55%;
  overflow: visible;
}

/* X mark */
.tt-cell--x svg line {
  stroke: #8ff1ff;
  stroke-width: 6;
  stroke-linecap: round;
  filter: drop-shadow(0 0 6px rgba(143, 241, 255, .8));
}

/* O mark */
.tt-cell--o svg circle {
  fill: none;
  stroke: #ff9fdb;
  stroke-width: 5.5;
  filter: drop-shadow(0 0 6px rgba(255, 159, 219, .8));
}

/* Win cell highlight */
.tt-cell--win {
  background: rgba(37, 236, 255, 0.1);
  box-shadow: inset 0 0 24px rgba(37, 236, 255, 0.12);
}

/* Win line */
#ttWinLine {
  stroke: #8ff1ff;
  stroke-width: 4;
  stroke-linecap: round;
  filter: drop-shadow(0 0 8px rgba(143, 241, 255, .9));
  opacity: 0;
  transition: opacity 300ms ease;
}

#ttWinLine.tt-visible {
  opacity: 1;
}

/* Cell entrance animation */
@keyframes cell-pop {
  0% { transform: scale(0.6); opacity: 0; }
  60% { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}

.tt-cell.just-placed {
  animation: cell-pop 320ms cubic-bezier(.34, 1.56, .64, 1) forwards;
}

/* Win line drawing animation */
@keyframes line-draw {
  from { stroke-dashoffset: var(--line-length); }
  to { stroke-dashoffset: 0; }
}

#ttWinLine.tt-visible {
  animation: line-draw 450ms ease forwards;
}

/* Win pulse on cells */
@keyframes win-pulse {
  0%, 100% { box-shadow: inset 0 0 24px rgba(37, 236, 255, .12); }
  50% { box-shadow: inset 0 0 36px rgba(37, 236, 255, .25); }
}

.tt-cell--win {
  animation: win-pulse 1.4s ease-in-out infinite;
}

/* Lose pulse */
@keyframes lose-pulse {
  0%, 100% { box-shadow: inset 0 0 24px rgba(255, 79, 198, .12); }
  50% { box-shadow: inset 0 0 36px rgba(255, 79, 198, .25); }
}

.tt-cell--lose {
  animation: lose-pulse 1.4s ease-in-out infinite;
}

.tt-hint {
  margin: .8rem 0 0;
  color: #d5d1ff;
  font-size: .9rem;
  text-align: center;
}

.tt-restart-btn {
  display: block;
  margin: .8rem auto 0;
  padding: .6rem 1.4rem;
  font-family: "Orbitron", system-ui, sans-serif;
  font-size: .85rem;
  letter-spacing: .04em;
}

/* Difficulty selector */
.tt-difficulty {
  display: flex;
  gap: .4rem;
  justify-content: center;
  margin-bottom: .6rem;
}

.tt-diff-btn {
  border: 1px solid rgba(132, 173, 255, 0.35);
  background: rgba(18, 30, 77, 0.5);
  color: #b8c1ea;
  border-radius: .4rem;
  padding: .3rem .7rem;
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 180ms ease;
}

.tt-diff-btn:hover {
  border-color: rgba(37, 236, 255, 0.6);
  color: #d8f8ff;
}

.tt-diff-btn--active {
  border-color: rgba(37, 236, 255, 0.8);
  background: rgba(37, 236, 255, 0.15);
  color: #d8f8ff;
}

@media (max-width: 980px) {
  .tt-page .game-panel { padding: .8rem; }
}

@media (max-width: 720px) {
  .tt-topbar { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .4rem; }
  .tt-stat { padding: .45rem .5rem; }
  .tt-stat span { font-size: .65rem; }
  .tt-stat strong { font-size: .92rem; }
  .tt-status { font-size: .95rem; }
  .tt-hint { font-size: .84rem; }
}
