/* ==========================================================
   Tic Tac Toss — 3D dice background
   Depends on: tokens.css
   ========================================================== */

#ttt-hero {
  position: relative;
  overflow: hidden;
}
#ttt-hero[data-bg="A"] { background: linear-gradient(135deg, #ffffff 0%, #f0f4ff 60%, #e8f9f0 100%); }
#ttt-hero[data-bg="B"] { background: linear-gradient(135deg, #ffffff 0%, #edfaf3 60%, #f0f4ff 100%); }

/* ── Background stage ── */
#ttt-stage { position: absolute; inset: 0; z-index: 0; overflow: hidden; }

.ttt-sceneA {
  position: absolute; inset: 0;
  perspective: 1150px; perspective-origin: 60% 38%;
  opacity: 0; transition: opacity 500ms ease;
}
#ttt-hero[data-bg="A"] .ttt-sceneA { opacity: 1; }

#ttt-sceneB {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; transition: opacity 500ms ease;
}
#ttt-hero[data-bg="B"] #ttt-sceneB { opacity: 1; }

/* floor / glow overlays */
.ttt-glowA {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(70% 55% at 62% 6%, rgba(255,255,255,0.12), transparent 62%);
}
.ttt-floorA {
  position: absolute; left: 0; right: 0; bottom: 0; height: 44%; pointer-events: none;
  background: linear-gradient(180deg, transparent 0%, rgba(200,240,220,0.10) 60%, rgba(200,220,255,0.12) 100%);
}

/* ── CSS-3D dice ── */
.ttt-fieldA { position: absolute; inset: 0; transform-style: preserve-3d; contain: layout style; }
.ttt-die    { position: absolute; transform-style: preserve-3d; will-change: transform; }
.ttt-bob    { transform-style: preserve-3d; will-change: transform; }
.ttt-cube   { position: relative; transform-style: preserve-3d; will-change: transform; }
.ttt-face   {
  position: absolute; display: grid; grid-template-columns: repeat(3,1fr); grid-template-rows: repeat(3,1fr);
  padding: 13%; backface-visibility: hidden;
}
.ttt-face span { place-self: center; width: 0; height: 0; }
.ttt-face .pip {
  width: 60%; aspect-ratio: 1; height: auto; border-radius: 50%;
  background: #fff;
}
.ttt-glow {
  position: absolute; left: 50%; top: 62%; transform: translate(-50%,-50%);
  border-radius: 50%; filter: blur(30px); opacity: 0.75; pointer-events: none;
}

@keyframes tttSpinA { from { transform: rotateX(0)    rotateY(0);    } to { transform: rotateX(360deg)  rotateY(360deg);  } }
@keyframes tttSpinB { from { transform: rotateX(0)    rotateZ(0);    } to { transform: rotateX(-360deg) rotateZ(360deg);  } }
@keyframes tttSpinC { from { transform: rotateY(0)    rotateZ(0);    } to { transform: rotateY(360deg)  rotateZ(-360deg); } }
@keyframes tttBob   { 0%,100% { transform: translateY(-15px); } 50% { transform: translateY(15px); } }
@keyframes tttDrift { from { transform: translate(-2.6vw,-1.4vh); } to { transform: translate(2.6vw,1.4vh); } }

/* ── Readability scrim — light on RIGHT where text lives ── */
.ttt-scrim {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(
    92% 85% at 88% 50%,
    rgba(255, 255, 255, 0.90)  0%,
    rgba(255, 255, 255, 0.60) 38%,
    transparent               68%
  );
}

/* ── Content above canvas ── */
.ttt-hero-content { position: relative; z-index: 2; }

/* ── Director panel ── */
.ttt-director {
  position: fixed; right: 20px; bottom: 20px; z-index: 9999;
  border-radius: 16px; overflow: hidden;
  background: rgba(10, 12, 20, 0.82);
  border: 1px solid rgba(255,255,255,0.12);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 16px 40px rgba(0,0,0,0.5);
  color: #fff; font-family: var(--font-body);
  transition: transform var(--dur-slow) var(--ease-out);
}
.ttt-director.min { transform: translateY(calc(100% - 46px)); }

.ttt-dir-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; cursor: pointer; user-select: none; gap: 10px;
}
.ttt-dir-head .t { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 12.5px; }
.ttt-dir-head .t .tdir-icon { font-size: 15px; color: #52c184; }
.ttt-dir-head .chev { font-size: 17px; opacity: 0.5; transition: transform var(--dur-slow) var(--ease-out); }
.ttt-director.min .ttt-dir-head .chev { transform: rotate(180deg); }

.ttt-dir-body { padding: 2px 14px 14px; }
.ttt-dir-label { font-size: 10px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.5; display: block; margin: 12px 0 7px; }
.ttt-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ttt-seg button {
  font-family: var(--font-body); font-size: 12px; font-weight: 600;
  color: rgba(255,255,255,0.7); background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.10); padding: 9px 8px;
  border-radius: 10px; cursor: pointer; transition: all var(--dur-base) var(--ease-out);
}
.ttt-seg button:hover { background: rgba(255,255,255,0.14); color: #fff; }
.ttt-seg button.on { background: #1f8a4e; border-color: transparent; color: #fff; box-shadow: 0 4px 12px rgba(31,138,78,0.45); }

@media (max-width: 560px) { .ttt-director { right: 12px; left: 12px; } }
