/* =========================================================
   TOESTELLENTOREN — online 1v1 stapelspel
   ========================================================= */

.tt{
  max-width: 680px;
  margin: 0 auto 4rem;
}

.tt-intro{
  text-align: center;
  margin-bottom: 1.5rem;
}
.tt-intro h2{ margin-bottom: 0.5rem; }
.tt-intro p{ color: var(--ink-soft); }

.tt-noscript{
  background: var(--danger-soft);
  border: 2px solid var(--danger);
  color: var(--ink);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.2rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

.tt-card{
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
}
.tt-card[hidden], .tt-game[hidden], .tt-over[hidden], .tt-noscript[hidden]{ display: none; }
.tt-center{ text-align: center; }

.tt-label{
  display: block;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.4rem;
}
.tt-input{
  width: 100%;
  font: inherit;
  font-size: 1rem;
  padding: 0.75em 1em;
  border-radius: var(--radius-md);
  border: 2px solid var(--line);
  background: var(--bg);
  color: var(--ink);
}
.tt-input:focus{ border-color: var(--primary); outline: none; }

.tt-h3{ margin: 1.5rem 0 0.75rem; }
.tt-center .tt-h3{ margin-top: 0; }
.tt-muted{ color: var(--ink-soft); }
.tt-small{ font-size: 0.85rem; }

.tt-actions{
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
}
.tt-center .tt-actions{ justify-content: center; }

.tt-lobby-list{
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}
.tt-lobby-item{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0.7rem 0.7rem 1.1rem;
  border: 2px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg);
}
.tt-lobby-item strong{ overflow-wrap: anywhere; }
.tt-lobby-item .btn{ padding: 0.55em 1.2em; font-size: 0.85rem; white-space: nowrap; }

/* ---------- spel ---------- */
.tt-hud{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.25rem;
  margin-bottom: 0.75rem;
}
.tt-hud-turn{
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}
.tt-hud-turn .tt-dot{
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid #17251f;
  flex: none;
}
.tt-hud-stats{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--ink-soft);
}
.tt-hud-stats strong{ color: var(--ink); }
.tt-next{ display: inline-flex; align-items: center; gap: 0.4rem; }
.tt-next canvas{
  width: 88px; height: 56px;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.tt-game{
  /* breedte volgt de hoogte van het scherm, zodat het beeld nooit uitrekt */
  width: min(100%, calc(78vh * 600 / 680));
  margin: 0 auto;
}
.tt-stage{
  position: relative;
  border: 4px solid #17251f;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  background: #cfdbe6;
  line-height: 0;
}
.tt-canvas{
  display: block;
  width: 100%;
  aspect-ratio: 600 / 680;
  height: auto;
  touch-action: pan-y;
  cursor: ew-resize;
}
.tt-status{
  position: absolute;
  left: 0; right: 0; top: 0.6rem;
  margin: 0;
  text-align: center;
  line-height: 1.3;
  pointer-events: none;
}
.tt-status:empty{ display: none; }
.tt-status span{
  display: inline-block;
  padding: 0.35em 1em;
  border-radius: 999px;
  background: rgba(23, 37, 31, 0.82);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.tt-over{
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  text-align: center;
  line-height: 1.5;
  background: rgba(246, 248, 241, 0.92);
  color: var(--ink);
  animation: tt-pop .4s var(--ease-spring);
}
.tt-over[hidden]{ display: none; }
.tt-over h3{ font-size: 1.7rem; margin: 0 0 0.4rem; }
.tt-over p{ margin: 0; }
.tt-over .tt-actions{ justify-content: center; }
.tt-over-stats{
  display: flex;
  gap: 1.5rem;
  margin: 1.1rem 0 0;
}
.tt-over-stats div{ text-align: center; }
.tt-over-stats dt{
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.tt-over-stats dd{
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
}
@keyframes tt-pop{
  from{ opacity: 0; transform: scale(0.92); }
  to{ opacity: 1; transform: scale(1); }
}

.tt-controls{
  display: grid;
  grid-template-columns: 1fr 1fr 2.4fr 1fr 1fr;
  gap: 0.5rem;
  margin-top: 0.9rem;
}
.tt-btn{
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 1.3rem;
  min-height: 3.4rem;
  border-radius: var(--radius-md);
  border: 3px solid #17251f;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 4px 0 #17251f;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  transition: transform .12s var(--ease-out), box-shadow .12s var(--ease-out), background .2s;
}
.tt-btn:active,
.tt-btn.is-held{
  transform: translateY(3px);
  box-shadow: 0 1px 0 #17251f;
}
.tt-btn-drop{
  background: var(--accent);
  font-size: 1.05rem;
}
.tt-btn:disabled{
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 4px 0 #17251f;
}
.tt-keys{ margin-top: 0.9rem; text-align: center; }
.tt-surrender-wrap{ text-align: center; margin-top: 0.9rem; }
.tt-surrender-wrap[hidden], .tt-surrender-wrap .btn[hidden]{ display: none; }
.tt-surrender-wrap .btn{ padding: 0.55em 1.3em; font-size: 0.85rem; }

@media (max-width: 480px){
  .tt-card{ padding: 1.25rem; }
  .tt-btn{ font-size: 1.1rem; min-height: 3.1rem; }
  .tt-btn-drop{ font-size: 0.9rem; }
  .tt-over h3{ font-size: 1.4rem; }
}

@media (prefers-reduced-motion: reduce){
  .tt-over{ animation: none; }
}
