/* ==========================================================================
 * Game 01a: Count the Cubes (数方块 / 큐브 세기)
 * Obsidian-and-brass 3D isometric sculpture + 20s crimson laser lockout
 * ========================================================================== */

.ctc-layout {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.95fr);
  gap: 18px;
  align-items: start;
}

.ctc-viewport-card {
  position: relative;
  border-radius: var(--dp-radius-lg);
  border: 1px solid var(--dp-border-strong);
  background:
    radial-gradient(ellipse 70% 55% at 50% 28%, rgba(212, 175, 106, 0.12), transparent 68%),
    radial-gradient(ellipse 65% 50% at 50% 88%, rgba(15, 23, 42, 0.8), #070910 85%);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.68), inset 0 1px 0 rgba(242, 213, 145, 0.14);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.ctc-viewport-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--dp-border-subtle);
  background: rgba(10, 12, 20, 0.72);
  backdrop-filter: blur(8px);
}

.ctc-tier-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--dp-border-strong);
  background: rgba(212, 175, 106, 0.14);
  color: var(--dp-brass-bright);
}

.ctc-tier-pill.is-hard {
  border-color: rgba(220, 53, 69, 0.55);
  background: rgba(220, 53, 69, 0.16);
  color: #ff8e99;
}

.ctc-canvas-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 12;
  min-height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  cursor: grab;
  user-select: none;
}

.ctc-canvas-wrap:active {
  cursor: grabbing;
}

.ctc-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.ctc-viewport-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-top: 1px solid var(--dp-border-subtle);
  background: rgba(10, 12, 20, 0.78);
  flex-wrap: wrap;
}

.ctc-viewport-hint {
  flex: 1 1 190px;
  min-width: 0;
  color: var(--dp-ink-muted);
  font-size: 11.5px;
  line-height: 1.4;
}

.ctc-orbit-controls {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.ctc-layer-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--dp-border-subtle);
  background: rgba(12, 15, 24, 0.88);
  flex-wrap: wrap;
}

.ctc-layer-bar input[type="range"] {
  flex: 1;
  min-width: 120px;
  accent-color: var(--dp-brass);
}

.ctc-reveal-banner {
  position: absolute;
  top: 62px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 18px;
  border-radius: 999px;
  background: rgba(12, 16, 28, 0.92);
  border: 1px solid var(--dp-brass);
  box-shadow: 0 0 28px rgba(212, 175, 106, 0.32);
  font-family: var(--dp-font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--dp-brass-bright);
  letter-spacing: 0.05em;
  pointer-events: none;
  white-space: nowrap;
  z-index: 5;
}

/* Right Terminal Panel */
.ctc-side-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ctc-terminal {
  position: relative;
  border-radius: var(--dp-radius-lg);
  border: 1px solid var(--dp-border-strong);
  background: linear-gradient(180deg, rgba(20, 24, 38, 0.95), rgba(10, 12, 20, 0.98));
  padding: 18px;
  box-shadow: var(--dp-shadow-card);
  overflow: hidden;
}

.ctc-terminal-label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dp-brass);
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ctc-display {
  height: 64px;
  border-radius: 12px;
  border: 1px solid var(--dp-border-strong);
  background: #06080f;
  box-shadow: inset 0 2px 14px rgba(0, 0, 0, 0.8), 0 0 18px rgba(212, 175, 106, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  margin-bottom: 12px;
}

.ctc-display-num {
  font-family: var(--dp-font-mono);
  font-size: 34px;
  font-weight: 700;
  color: var(--dp-brass-bright);
  letter-spacing: 0.08em;
}

.ctc-display-num.is-placeholder {
  color: var(--dp-ink-faint);
  font-size: 20px;
  letter-spacing: 0.04em;
}

.ctc-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.ctc-key {
  min-height: 48px;
  border-radius: 10px;
  border: 1px solid var(--dp-border);
  background: rgba(26, 31, 48, 0.88);
  font-family: var(--dp-font-mono);
  font-size: 20px;
  font-weight: 700;
  color: var(--dp-ink);
  transition: transform 0.12s var(--dp-ease), background 0.15s, border-color 0.15s;
}

.ctc-key:hover:not(:disabled) {
  border-color: var(--dp-brass);
  background: rgba(212, 175, 106, 0.16);
  transform: translateY(-1px);
}

.ctc-key:active:not(:disabled) {
  transform: translateY(1px);
}

.ctc-key-fn {
  font-size: 13px;
  font-family: var(--dp-font-ui);
  color: var(--dp-ink-muted);
}

.ctc-submit-btn {
  width: 100%;
  margin-top: 10px;
  min-height: 48px;
  font-size: 15px;
  letter-spacing: 0.06em;
}

/* 20-Second Crimson Lockout Laser Overlay */
.ctc-lockout-overlay {
  position: absolute;
  inset: 0;
  z-index: 12;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(220, 53, 69, 0.12) 0px,
      rgba(220, 53, 69, 0.12) 2px,
      transparent 2px,
      transparent 8px
    ),
    radial-gradient(circle at 50% 45%, rgba(168, 20, 36, 0.92), rgba(28, 6, 12, 0.96));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  animation: ctcLockFlash 0.35s ease;
}

.ctc-lockout-overlay::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, #ff4d5e, #fff, #ff4d5e, transparent);
  box-shadow: 0 0 18px #ff3347;
  animation: ctcLaserScan 1.8s linear infinite;
}

@keyframes ctcLaserScan {
  0% { top: 0%; opacity: 0.9; }
  50% { top: 100%; opacity: 1; }
  100% { top: 0%; opacity: 0.9; }
}

@keyframes ctcLockFlash {
  0% { opacity: 0; transform: scale(1.03); }
  100% { opacity: 1; transform: scale(1); }
}

.ctc-lockout-badge {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: #ff9ca6;
  border: 1px solid rgba(255, 110, 126, 0.6);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 10px;
  background: rgba(0, 0, 0, 0.35);
}

.ctc-lockout-time {
  font-family: var(--dp-font-mono);
  font-size: 46px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 0 24px rgba(255, 64, 82, 0.9);
  line-height: 1;
}

.ctc-solved-overlay {
  padding: 18px;
  border-radius: 12px;
  border: 1px solid rgba(34, 197, 94, 0.55);
  background: rgba(34, 197, 94, 0.12);
  text-align: center;
}

/* Live Race Leaderboard */
.ctc-board-card {
  border-radius: var(--dp-radius-lg);
  border: 1px solid var(--dp-border);
  background: rgba(14, 17, 26, 0.86);
  padding: 14px 16px;
}

.ctc-rank-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 10px;
}

.ctc-rank-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 11px;
  border-radius: 10px;
  border: 1px solid var(--dp-border-subtle);
  background: rgba(255, 255, 255, 0.025);
  font-size: 13px;
}

.ctc-rank-row.is-me {
  border-color: var(--dp-border-strong);
  background: rgba(212, 175, 106, 0.1);
}

.ctc-rank-row.is-solved {
  border-color: rgba(34, 197, 94, 0.48);
  background: rgba(34, 197, 94, 0.09);
}

.ctc-rank-row.is-locked {
  border-color: rgba(220, 53, 69, 0.45);
  background: rgba(220, 53, 69, 0.09);
}

.ctc-status-chip {
  font-family: var(--dp-font-mono);
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 700;
}

.ctc-status-chip.is-ok {
  background: rgba(34, 197, 94, 0.2);
  color: #86efac;
}

.ctc-status-chip.is-lock {
  background: rgba(220, 53, 69, 0.25);
  color: #ff9ca6;
}

.ctc-status-chip.is-wait {
  background: rgba(255, 255, 255, 0.07);
  color: var(--dp-ink-muted);
}

@media (max-width: 900px) {
  .ctc-layout {
    grid-template-columns: 1fr;
  }
  .ctc-canvas-wrap {
    min-height: 290px;
    aspect-ratio: 4 / 3;
  }
}
