.ttt-page {
  position: relative;
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(135deg, #2f0d5b 0%, #4f1d7f 38%, #5b2d84 100%);
  font-family: var(--font-family);
  color: #fff;
  overflow-x: hidden;
}

.ttt-page::before,
.ttt-page::after {
  content: "";
  position: fixed;
  right: -120px;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  pointer-events: none;
  z-index: 0;
}

.ttt-page::before {
  top: 120px;
  right: -100px;
}

.ttt-page::after {
  top: 520px;
  right: -160px;
  width: 500px;
  height: 500px;
}

.ttt-shell {
  position: relative;
  z-index: 1;
  min-height: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: visible;
  padding: 12px 20px 30px;
}

.ttt-top-info {
  position: relative;
  top: 0;
  left: auto;
  transform: none;
  width: min(1080px, 92vw);
  border-radius: 34px;
  border: 10px solid #ffffff;
  background: #ffffff;
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.25);
  padding: 10px 18px;
  margin-bottom: 18px;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.ttt-top-info-title {
  color: #0f172a;
  font-size: 1.45rem;
  font-weight: 800;
  margin: 0;
  line-height: 1;
  white-space: nowrap;
}

.ttt-top-actions-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  margin-left: auto;
}

.ttt-top-action,
.ttt-share-btn {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  border: 0;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  background: transparent;
  cursor: pointer;
  color: #374151;
  font-size: var(--font-size-sm);
  font-weight: 600;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.ttt-top-action:hover,
.ttt-share-btn:hover {
  background: rgba(109, 40, 217, 0.08);
  color: #4c1d95;
}
}

.ttt-top-action__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: #475569;
  line-height: 1;
}

.ttt-top-action__icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#btnPauseTop[hidden] { display: none; }

.ttt-stage {
  width: min(1080px, 92vw);
  height: clamp(520px, 72vh, 690px);
  border-radius: 38px;
  border: 12px solid #ffffff;
  background: radial-gradient(circle at 80% 12%, rgba(255,255,255,0.16) 0 1px, transparent 1px 6px),
              linear-gradient(135deg, #13377c 0%, #0f3479 55%, #102f69 100%);
  background-size: 8px 8px, auto;
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 44px rgba(0,0,0,0.35);
}

.ttt-stage[data-current-view='game'] {
  background:
    radial-gradient(circle at 80% 12%, rgba(255,255,255,0.16) 0 1px, transparent 1px 6px),
    linear-gradient(135deg, rgba(88, 31, 134, 0.88) 0%, rgba(92, 45, 153, 0.82) 38%, rgba(91, 45, 132, 0.8) 100%);
  background-size: 8px 8px, auto;
}

.ttt-stage[data-current-view='mode'],
.ttt-stage[data-current-view='custom'],
.ttt-stage[data-current-view='setup'] {
  background:
    radial-gradient(circle at 80% 12%, rgba(255,255,255,0.16) 0 1px, transparent 1px 6px),
    linear-gradient(135deg, rgba(88, 31, 134, 0.88) 0%, rgba(92, 45, 153, 0.82) 38%, rgba(91, 45, 132, 0.8) 100%);
  background-size: 8px 8px, auto;
}

.ttt-stage:fullscreen,
.ttt-stage:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  border-radius: 0;
  border: none;
  box-shadow: none;
}

.ttt-stage:fullscreen .ttt-view,
.ttt-stage:-webkit-full-screen .ttt-view {
  padding-top: 92px;
}

.ttt-top-controls {
  position: absolute;
  top: 18px;
  left: 18px;
  right: 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  z-index: 24;
  pointer-events: none;
}

.ttt-top-left,
.ttt-top-right {
  display: flex;
  gap: 10px;
  pointer-events: auto;
}

.ttt-top-left {
  flex-direction: column;
}

.ttt-top-right {
  flex-direction: column;
}

.ttt-icon-btn {
  width: 56px;
  height: 56px;
  border-radius: 999px;
  border: 3px solid rgba(104, 208, 255, 0.6);
  background: rgba(16, 49, 118, 0.72);
  color: #fff;
  font-size: 1.65rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--transition-fast), filter var(--transition-fast);
}

.ttt-stage[data-current-view='mode'] #btnOpenSettings,
.ttt-stage[data-current-view='custom'] #btnOpenSettings,
.ttt-stage[data-current-view='setup'] #btnOpenSettings,
.ttt-stage[data-current-view='game'] #btnOpenSettings {
  display: none !important;
}

.ttt-icon-btn:hover {
  transform: translateY(-2px) scale(1.03);
  filter: brightness(1.12);
}

.ttt-icon-btn--utility {
  border-color: rgba(255, 182, 84, 0.95);
  background: radial-gradient(circle at 30% 30%, #ffb74d, #e56f0f);
  color: rgba(255,255,255,0.95);
}

#btnRestartTop {
  border-color: rgba(255, 198, 112, 0.98);
  background: radial-gradient(circle at 30% 30%, #ff9f1c, #c94f00);
}

#btnFullscreen {
  border-color: rgba(255, 224, 112, 0.98);
  background: radial-gradient(circle at 30% 30%, #ffd54f, #d99a00);
}

.ttt-icon-btn--danger {
  border-color: rgba(255, 150, 150, 0.98);
  background: radial-gradient(circle at 30% 30%, #ff6d6d, #d62828);
  color: rgba(255,255,255,0.98);
}

.ttt-icon-btn--sound {
  position: relative;
  border-color: rgba(126, 216, 255, 0.9);
  background: radial-gradient(circle at 28% 26%, #31b7f0, #1f65b8);
  color: #ffffff;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.18), 0 4px 10px rgba(9, 44, 95, 0.45);
}

.ttt-icon-btn--sound.is-muted {
  border-color: rgba(170, 198, 236, 0.8);
  background: radial-gradient(circle at 28% 26%, #6c85b6, #3a4f7d);
  color: rgba(255, 255, 255, 0.95);
}

.ttt-icon-btn--sound.is-muted::after {
  content: '';
  position: absolute;
  width: 34px;
  height: 3px;
  background: #ff7b7b;
  border-radius: 999px;
  transform: rotate(-38deg);
}

.ttt-restart-icon {
  display: none;
  font-size: 1.8rem;
}

.ttt-stage[data-current-view='game'] .ttt-restart-icon {
  display: inline-flex;
}

.ttt-view {
  display: none;
  width: 100%;
  height: 100%;
  padding: 96px 56px 40px;
}

.ttt-view.active {
  display: flex;
}

.ttt-view--intro {
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  padding-top: 110px;
  background: radial-gradient(circle at 80% 12%, rgba(255,255,255,0.16) 0 1px, transparent 1px 6px),
              linear-gradient(180deg, #7b1cd4 0%, #580a98 55%, #4d087f 100%);
  background-size: 8px 8px, auto;
}

.ttt-intro-title {
  margin: 0;
  font-size: clamp(2.6rem, 6vw, 5rem);
  line-height: 1;
  letter-spacing: 0.02em;
  font-weight: 900;
  color: #fff;
  text-align: center;
  text-shadow: 0 6px 0 rgba(0,0,0,0.24);
}

.ttt-intro-card {
  width: min(1060px, 95%);
  background: rgba(43, 4, 79, 0.72);
  border-radius: 18px;
  padding: 24px 30px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: auto;
  margin-bottom: 18px;
}

.ttt-intro-card p {
  margin: 0;
  color: rgba(255,255,255,0.92);
  font-size: clamp(1rem, 1.8vw, 1.25rem);
  line-height: 1.5;
  max-width: 900px;
}

.ttt-view--menu,
.ttt-view--mode {
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ttt-view--custom {
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ttt-custom-card {
  width: min(740px, 88vw);
  background: linear-gradient(180deg, #72b8d0 0 28%, #4d9db2 28% 100%);
  border: 8px solid #2f49bf;
  border-radius: 44px;
  padding: 24px 26px 22px;
  box-shadow: inset 0 0 0 5px rgba(210, 244, 255, 0.9);
  text-align: center;
}

.ttt-custom-title {
  margin: 0;
  color: #1f42ae;
  font-size: clamp(2.2rem, 5vw, 4rem);
  line-height: 1;
  font-weight: 900;
}

.ttt-custom-row {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 92px 1fr 92px;
  gap: 14px;
  align-items: center;
}

.ttt-custom-step {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  border: 5px solid #2443a9;
  background: linear-gradient(180deg, #2f58cc 0%, #2442a8 100%);
  color: #fff;
  font-size: 3.5rem;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.ttt-custom-step:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ttt-custom-value {
  border-radius: 24px;
  border: 4px solid #2f49bf;
  background: linear-gradient(180deg, #d7e5ff 0%, #c4d6f6 100%);
  color: #2042ac;
  font-size: clamp(2rem, 4.4vw, 4.2rem);
  font-weight: 900;
  padding: 10px 20px;
  line-height: 1;
}

.ttt-custom-start {
  margin-top: 18px;
  padding: 16px 54px;
}

.ttt-custom-difficulty {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}

.ttt-custom-label {
  color: #2042ac;
  font-weight: 800;
  font-size: 1.05rem;
  text-align: left;
  padding-inline: 2px;
}

.ttt-custom-value--difficulty {
  text-transform: capitalize;
}

.ttt-view--mode {
  justify-content: center;
  overflow: hidden;
}

.ttt-view--mode .ttt-title {
  font-size: clamp(3rem, 7.2vw, 5.2rem);
}

.ttt-view--mode .ttt-symbols {
  margin-top: 12px;
  font-size: clamp(5rem, 12vw, 10.6rem);
}

.ttt-view--mode .ttt-btn-row {
  margin-top: 24px;
}

.ttt-name-setup {
  margin-top: 14px;
  width: min(560px, 86vw);
  background: rgba(10, 39, 94, 0.45);
  border: 2px solid rgba(133, 212, 255, 0.45);
  border-radius: 18px;
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.ttt-name-field {
  color: #dbefff;
  font-weight: 700;
  font-size: 0.98rem;
}

.ttt-name-input {
  width: 100%;
  border-radius: 12px;
  border: 2px solid rgba(157, 217, 255, 0.9);
  background: rgba(7, 27, 72, 0.85);
  color: #ffffff;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 10px 12px;
  outline: none;
}

.ttt-name-input:focus {
  border-color: #8be0ff;
  box-shadow: 0 0 0 3px rgba(139, 224, 255, 0.18);
}

.ttt-name-input:disabled {
  opacity: 0.78;
  cursor: not-allowed;
}

.ttt-mode-continue {
  justify-self: center;
  margin-top: 4px;
  padding: 11px 30px;
  font-size: 1.2rem;
}

.ttt-name-setup--setup {
  width: min(520px, 86vw);
  margin-bottom: 14px;
}

#btnOnePlayer.is-active,
#btnTwoPlayers.is-active {
  filter: brightness(1.18);
  transform: translateY(-1px);
}

.ttt-title {
  margin: 0;
  color: #ffbe2f;
  text-shadow: 0 6px 0 rgba(0,0,0,0.3);
  font-size: clamp(3.2rem, 8vw, 6rem);
  line-height: 1;
  font-weight: 900;
}

.ttt-symbols {
  margin-top: 18px;
  color: #1cc8ff;
  text-shadow: 0 8px 0 rgba(0,0,0,0.28);
  font-size: clamp(6.2rem, 15vw, 13rem);
  line-height: 0.95;
  letter-spacing: 0.03em;
  font-weight: 900;
}

.ttt-btn-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  margin-top: 36px;
  flex-wrap: wrap;
}

.ttt-primary-btn,
.ttt-secondary-btn {
  border-radius: 30px;
  border: 3px solid rgba(157, 217, 255, 0.85);
  color: #fff;
  background: linear-gradient(180deg, #284ab8 0%, #1f3ca7 100%);
  font-weight: 800;
  font-size: clamp(1.15rem, 1.8vw, 2rem);
  padding: 14px 46px;
  cursor: pointer;
  box-shadow: inset 0 -8px 0 rgba(0,0,0,0.18), 0 10px 20px rgba(0,0,0,0.22);
  transition: transform var(--transition-fast), filter var(--transition-fast);
}

#btnPlayNow {
  display: block;
  margin: 40px auto 12px;
  align-self: center;
  padding: 18px 64px;
  font-size: clamp(1.5rem, 2.2vw, 2.5rem);
  border-color: rgba(178, 255, 189, 0.95);
  background: linear-gradient(180deg, #2fca56 0%, #1f9f3e 100%);
  box-shadow: inset 0 -8px 0 rgba(0,0,0,0.18), 0 12px 24px rgba(14, 90, 35, 0.35);
}

/* Settings overlay (pattern matched with other activities) */
.ttt-settings-overlay {
  position: absolute;
  inset: 0;
  background: rgba(4, 16, 50, 0.72);
  z-index: 40;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 28px 28px;
  backdrop-filter: blur(2px);
}
.ttt-settings-overlay.hidden { display: none; }
.ttt-settings-overlay__card {
  width: min(520px, 92%);
  max-height: calc(100% - 20px);
  overflow-y: auto;
  border-radius: 18px;
  border: 2px solid rgba(151, 216, 255, 0.45);
  background: rgba(6, 30, 78, 0.97);
  padding: 14px 16px 16px;
  display: grid;
  gap: 10px;
  margin-top: 18px;
}
.ttt-icon-btn--settings {
  border-color: rgba(160, 100, 220, 0.9);
  background: radial-gradient(circle at 30% 30%, #7b2abf, #4a0e8f);
  color: #ffffff;
}
.ttt-settings-overlay__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}
.ttt-settings-overlay__title {
  color: #dbefff;
  font-size: 1.05rem;
  font-weight: 700;
}
.ttt-settings-overlay__close {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: rgba(255,100,100,0.18);
  color: #ffaaaa;
  font-size: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ttt-settings-overlay__close:hover { background: rgba(255,100,100,0.36); color:#fff; }
.ttt-settings-panel { display: grid; gap: 12px; }
.ttt-settings-group { display: grid; gap: 6px; color: rgba(236, 248, 255, 0.95); }
.ttt-settings-title { font-size: 0.8rem; letter-spacing: 0.08em; color: rgba(188, 227, 255, 0.85); font-weight:700; }
.ttt-settings-row { display: grid; grid-template-columns: 92px 1fr 92px; gap: 14px; align-items: center; }

/* Overlay-specific compact controls to match spinner settings text style */
.ttt-overlay-step {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 5px solid #2443a9;
  background: linear-gradient(180deg, #2f58cc 0%, #2442a8 100%);
  color: #fff;
  font-size: 2rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.ttt-overlay-step:disabled { opacity: 0.5; cursor: not-allowed; }

.ttt-overlay-value {
  border-radius: 14px;
  border: 4px solid #2f49bf;
  background: linear-gradient(180deg, #d7e5ff 0%, #c4d6f6 100%);
  color: #2042ac;
  font-size: 2.2rem;
  font-weight: 900;
  padding: 14px 18px;
  text-align: center;
  line-height: 1;
}

.ttt-settings-panel .ttt-custom-difficulty .ttt-overlay-value { text-transform: capitalize; }

.ttt-primary-btn:hover,
.ttt-secondary-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.ttt-view--setup {
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  overflow-y: auto;
  padding-top: 70px;
}

.ttt-versus-wrap {
  display: flex;
  align-items: center;
  gap: 46px;
  margin-top: 24px;
}

.ttt-player-card {
  width: 180px;
  min-width: 180px;
  border-radius: 18px;
  border: 3px solid rgba(114, 224, 255, 0.55);
  background: linear-gradient(180deg, #6ed0f0 0%, #7ccde4 100%);
  padding: 8px;
  text-align: center;
}

.ttt-player-symbol {
  height: 96px;
  border-radius: 12px;
  background: #0d357c;
  color: #ffdf26;
  font-size: 3.2rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  text-shadow: 0 3px 0 rgba(0,0,0,0.3);
}

.ttt-player-label {
  margin-top: 8px;
  color: #0b3b77;
  font-size: clamp(1rem, 1.5vw, 2rem);
  font-weight: 800;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.1;
}

.ttt-vs {
  color: #fff;
  font-size: 4.6rem;
  font-weight: 900;
}

.ttt-setup-actions {
  margin-top: 40px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.ttt-view--game {
  flex-direction: column;
  align-items: center;
  padding-top: 40px;
  position: relative;
}

.ttt-game-topbar {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.ttt-timer {
  align-self: center;
  background: linear-gradient(180deg, #dbe9ff 0%, #c8ddff 100%);
  color: #0d3a74;
  border: 3px solid #5f88d6;
  border-radius: 20px;
  font-size: 2rem;
  font-weight: 900;
  padding: 6px 14px;
  min-width: 130px;
  text-align: center;
  margin: 0 auto;
}

.ttt-game-layout {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 160px 1fr 160px;
  gap: 18px;
  align-items: start;
  width: 100%;
  max-width: 980px;
  justify-items: center;
}

/* Move left/right score cards closer to the board */
#gameP1Card { justify-self: end; margin-right: 6px; transform: translateX(60px); transition: transform 200ms ease; }
#gameP2Card { justify-self: start; margin-left: 6px; transform: translateX(-60px); transition: transform 200ms ease; }

@media (max-width: 1000px) {
  #gameP1Card { transform: translateX(28px); }
  #gameP2Card { transform: translateX(-28px); }
}

@media (max-width: 700px) {
  /* on small screens keep minimal offset so layout doesn't break */
  #gameP1Card, #gameP2Card { transform: translateX(12px); }
  .ttt-game-layout { grid-template-columns: 120px 1fr 120px; gap: 12px; }
}

.ttt-score-card {
  margin-top: 8px;
  width: 180px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ttt-score-card .ttt-player-card {
  width: 100%;
}

.ttt-player-card--score {
  border-color: rgba(114, 224, 255, 0.75);
  background: linear-gradient(180deg, #71cce7 0%, #6ec5dd 100%);
  padding: 10px 10px 12px;
}

.ttt-player-card--score .ttt-player-label {
  color: #0b3b77;
  text-shadow: none;
  font-size: 1.2rem;
  margin-top: 6px;
  white-space: nowrap;
}

.ttt-score {
  margin-top: 8px;
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 700;
  text-shadow: 0 1px 0 rgba(0,0,0,0.35);
}

.ttt-turn {
  margin-top: 4px;
  color: rgba(255,255,255,0.88);
  font-size: 1rem;
  font-weight: 700;
}

.ttt-score-card .ttt-player-label {
  color: #0b3b77;
  font-size: clamp(0.9rem, 1.4vw, 1.1rem);
  text-shadow: none;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ttt-score-card .ttt-player-symbol {
  text-shadow: 0 5px 0 rgba(0,0,0,0.3);
}

.ttt-board-wrap {
  justify-self: center;
}

.ttt-score-card.active .ttt-player-card {
  box-shadow: 0 0 0 3px rgba(114, 224, 255, 0.55);
}

.ttt-board-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ttt-board-stage {
  width: min(460px, 68vw);
  aspect-ratio: 1;
  position: relative;
}

.ttt-board {
  --ttt-o-color: #ff3b3b;
  --ttt-x-color: #ffd62f;
  --ttt-board-size: 3;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: repeat(var(--ttt-board-size), 1fr);
  grid-template-rows: repeat(var(--ttt-board-size), 1fr);
  gap: 10px;
  background: #1a88db;
  border-radius: 18px;
  padding: 10px;
}

.ttt-win-line {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.ttt-win-line line {
  fill: none;
  stroke-width: 14;
  stroke-linecap: round;
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.35));
  transition: stroke-dashoffset 420ms ease;
}

.ttt-cell {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: none;
  border-radius: 12px;
  background: #10357a;
  color: #1cc8ff;
  font-size: var(--ttt-cell-font-size, clamp(3rem, 7vw, 5rem));
  line-height: 1;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: filter var(--transition-fast), transform var(--transition-fast);
}

.ttt-cell:hover:enabled {
  filter: brightness(1.2);
  transform: translateY(-1px);
}

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

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

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

.ttt-game-msg {
  margin-top: 16px;
  min-height: 30px;
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
}

.ttt-match-modal {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 17, 50, 0.52);
  z-index: 40;
}

.ttt-match-modal.hidden {
  display: none;
}

.ttt-match-modal__card {
  width: min(560px, 86vw);
  border-radius: 20px;
  border: 3px solid rgba(162, 223, 255, 0.9);
  background: linear-gradient(180deg, rgba(12, 47, 122, 0.98) 0%, rgba(9, 34, 92, 0.98) 100%);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.35);
  padding: 18px 18px 16px;
  text-align: center;
}

.ttt-match-modal__text {
  margin: 0;
  color: #ffffff;
  font-size: clamp(1.2rem, 2.4vw, 2rem);
  font-weight: 800;
}

.ttt-match-modal__actions {
  margin-top: 14px;
  gap: 12px;
}

.ttt-ranking-box {
  width: min(1080px, 92vw);
  margin-top: 18px;
  background: #ffffff;
  border-radius: 34px;
  border: 10px solid #ffffff;
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.25);
  padding: 16px 18px 18px;
  color: #0f172a;
}

.ttt-top-info.is-hidden,
.ttt-ranking-box.is-hidden {
  display: none;
}

.ttt-ranking-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.ttt-ranking-title {
  margin: 0;
  font-size: 1.95rem;
  font-weight: 700;
  color: #0f172a;
}

.ttt-ranking-reset {
  border: 1px solid #94a3b8;
  background: #ffffff;
  color: #334155;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}

.ttt-ranking-reset:hover {
  background: #f8fafc;
  color: #0f172a;
}

.ttt-ranking-table {
  width: 100%;
  border-collapse: collapse;
  border-radius: 4px;
  overflow: hidden;
}

.ttt-ranking-table thead th {
  background: #2093d6;
  color: #ffffff;
  text-align: left;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 6px 10px;
}

.ttt-ranking-table tbody td {
  padding: 5px 10px;
  font-size: 0.95rem;
  color: #111827;
  border-bottom: 1px solid #e5e7eb;
}

.ttt-ranking-table tbody tr:nth-child(even) {
  background: #f3f4f6;
}

.ttt-ranking-table tbody tr:nth-child(odd) {
  background: #ffffff;
}

.ttt-ranking-col-pos {
  width: 72px;
}

.ttt-ranking-col-size,
.ttt-ranking-col-wins,
.ttt-ranking-col-losses,
.ttt-ranking-col-result,
.ttt-ranking-col-time {
  text-align: center;
}

.ttt-ranking-col-size {
  width: 88px;
}

.ttt-ranking-col-wins,
.ttt-ranking-col-losses {
  width: 84px;
}

.ttt-ranking-col-result {
  width: 120px;
}

.ttt-ranking-col-time {
  width: 90px;
}

.ttt-ranking-col-del {
  width: 38px;
  text-align: center;
  color: #6b7280;
}

.ttt-ranking-delete {
  border: 0;
  background: transparent;
  color: #6b7280;
  font-size: 0.95rem;
  cursor: pointer;
  line-height: 1;
}

.ttt-ranking-delete:hover {
  color: #b91c1c;
}

.ttt-ranking-delete:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.ttt-ranking-pos {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}

.ttt-ranking-medal {
  font-size: 0.95rem;
  line-height: 1;
}

.ttt-ranking-pos.is-gold {
  color: #a16207;
}

.ttt-ranking-pos.is-silver {
  color: #475569;
}

.ttt-ranking-pos.is-bronze {
  color: #9a3412;
}

.ttt-ranking-pos.is-default {
  color: #374151;
}

.ttt-ranking-result {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 82px;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.8rem;
  font-weight: 700;
}

.ttt-ranking-result--win {
  background: #dcfce7;
  color: #166534;
}

.ttt-ranking-result--loss {
  background: #fee2e2;
  color: #991b1b;
}

.ttt-ranking-result--draw {
  background: #dbeafe;
  color: #1e3a8a;
}

.ttt-ranking-result--na {
  background: #e5e7eb;
  color: #4b5563;
}

.ttt-ranking-note {
  margin: 12px 0 0;
  text-align: center;
  color: #6b7280;
  font-size: 0.88rem;
}

@media (max-width: 1100px) {
  .ttt-stage {
    width: calc(100vw - 24px);
    border-width: 8px;
    border-radius: 28px;
  }

  .ttt-game-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .ttt-score-card {
    display: none;
  }

  .ttt-top-controls {
    top: 10px;
    left: 10px;
    right: 10px;
  }

  .ttt-ranking-box {
    width: calc(100vw - 24px);
  }
}

@media (max-width: 700px) {
  .ttt-view {
    padding: 84px 16px 24px;
  }

  .ttt-shell {
    padding-top: 12px;
  }

  .ttt-top-info {
    top: 0;
    border-width: 8px;
    border-radius: 26px;
    padding: 8px 10px;
    align-items: flex-start;
    flex-direction: column;
  }

  .ttt-top-actions-row {
    gap: 8px;
    justify-content: flex-start;
  }

  .ttt-top-info-title {
    font-size: 1.12rem;
  }

  .ttt-top-action,
  .ttt-share-btn {
    font-size: 0.8rem;
  }

  .ttt-title {
    font-size: 2.7rem;
  }

  .ttt-symbols {
    font-size: 5.2rem;
  }

  .ttt-player-card {
    width: 140px;
  }

  .ttt-player-symbol {
    height: 90px;
    font-size: 3.8rem;
  }

  .ttt-player-label {
    font-size: 1.2rem;
  }

  .ttt-vs {
    font-size: 2.8rem;
  }

  .ttt-custom-card {
    border-width: 6px;
    border-radius: 30px;
    padding: 16px 14px 14px;
  }

  .ttt-custom-row {
    grid-template-columns: 62px 1fr 62px;
    gap: 10px;
    margin-top: 12px;
  }

  .ttt-custom-step {
    width: 56px;
    height: 56px;
    border-width: 3px;
    font-size: 2.4rem;
  }

  .ttt-custom-value {
    font-size: clamp(1.4rem, 5vw, 2.2rem);
    border-width: 3px;
    padding: 8px 12px;
  }

  .ttt-ranking-box {
    width: 100%;
    padding: 12px;
  }

  .ttt-ranking-title {
    font-size: 1.55rem;
  }

  .ttt-ranking-table thead th,
  .ttt-ranking-table tbody td {
    font-size: 0.82rem;
    padding: 5px 6px;
  }

    .ttt-ranking-box {
      overflow-x: auto;
    }

    .ttt-ranking-table {
      min-width: 940px;
    }

}
