/* ====== admin.css — 진행자 화면 (반응형) ====== */

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  flex-wrap: wrap;
  gap: 0.75rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

.app-header h1 {
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.app-header .header-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

@media (max-width: 600px) {
  .app-header { padding: 0.6rem 0.8rem; }
  .app-header h1 { font-size: 1rem; }
  .app-header .header-actions button { font-size: 0.8rem; padding: 0.4rem 0.7rem; min-height: 34px; }
}

.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1rem;
  padding: 1rem;
  /* 헤더가 wrap되어 60px 넘게 커지더라도 잘리지 않도록 min-height 사용 */
  min-height: calc(100vh - 64px);
}

.layout-full {
  padding: 1rem;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    min-height: 0;
  }
}

@media (max-width: 600px) {
  .layout, .layout-full { padding: 0.6rem; }
}

/* 진행자 패널의 컨트롤 행 — 좁은 화면에서도 줄바꿈 + 동일 크기 유지 */
.controls-row { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.controls-row > button { flex: 0 0 auto; }
@media (max-width: 480px) {
  .controls-row > button { flex: 1 1 calc(50% - 0.4rem); min-width: 0; }
}

.scoreboard-side {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  overflow-y: auto;
  max-height: calc(100vh - 100px);
}

@media (max-width: 900px) {
  .scoreboard-side { max-height: none; order: 2; }
}

.score-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.7rem 0.85rem;
  margin-bottom: 0.5rem;
  background: var(--bg-3);
  border-radius: var(--radius);
  gap: 0.5rem;
}
.score-row .num { font-size: 1.4rem; font-weight: bold; }
.score-row.rank-1 { border: 2px solid #fbbf24; }
.score-row.rank-2 { border: 2px solid #cbd5e1; }
.score-row.rank-3 { border: 2px solid #d97706; }

.main-panel {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.3rem;
  overflow-y: auto;
}

@media (max-width: 600px) {
  .main-panel { padding: 0.85rem; }
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  gap: 0.75rem;
}

.game-title { font-size: 1.45rem; font-weight: bold; }
.timer { font-size: 1.5rem; font-family: ui-monospace, monospace; }

@media (max-width: 600px) {
  .game-title { font-size: 1.15rem; }
  .timer { font-size: 1.2rem; }
}

.question-box {
  padding: 1.4rem;
  margin: 1rem 0;
  background: var(--bg-3);
  border-radius: var(--radius-lg);
  text-align: center;
}

.question-text { font-size: 1.4rem; margin-bottom: 0.85rem; }
.answer-text { color: var(--success); font-size: 1.2rem; margin-top: 0.85rem; }

@media (max-width: 600px) {
  .question-box { padding: 1rem; }
  .question-text { font-size: 1.1rem; }
}

.media-controls {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: center;
  margin: 1rem 0;
}

.buzzer-list { margin: 1rem 0; }

.buzzer-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.5rem;
  background: var(--bg-3);
  border-radius: var(--radius);
  border-left: 4px solid var(--primary);
  gap: 0.5rem;
  flex-wrap: wrap;
}
.buzzer-item.correct { border-left-color: var(--success); background: #064e3b; }
.buzzer-item.wrong { border-left-color: var(--danger); opacity: 0.6; }

.controls-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}
@media (max-width: 600px) {
  .controls-row button { flex: 1 1 calc(50% - 0.25rem); justify-content: center; }
}

.session-list-row,
.theme-list-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1rem;
  margin-bottom: 0.5rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  gap: 0.5rem;
  flex-wrap: wrap;
}
.session-list-row > div:first-child,
.theme-list-row > div:first-child { flex: 1; min-width: 200px; }

@media (max-width: 600px) {
  .session-list-row > div:last-child,
  .theme-list-row > div:last-child { width: 100%; flex-wrap: wrap; }
}

.game-list-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.7rem 1rem;
  margin-bottom: 0.5rem;
  background: var(--bg-3);
  border-radius: var(--radius);
  gap: 0.5rem;
  flex-wrap: wrap;
  transition: outline 0.1s;
}
[data-gid] { transition: opacity 0.15s; }
[data-gid][draggable="true"] { cursor: default; }
.drag-handle:hover { color: var(--text); }
.drag-handle:active { cursor: grabbing; }
.game-list-row > div:first-child { flex: 1; min-width: 220px; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.game-list-row.active { border-left: 4px solid var(--primary); }

@media (max-width: 600px) {
  .game-list-row { padding: 0.7rem 0.85rem; }
  .game-list-row > div:last-child { width: 100%; }
  .game-list-row > div:last-child > .flex { flex-wrap: wrap; }
}

.q-list-row {
  padding: 0.5rem 0.75rem;
  margin: 0.25rem 0 0.25rem 2rem;
  background: var(--bg);
  border-radius: 6px;
  font-size: 0.875rem;
  display: flex;
  justify-content: space-between;
}

.qr-display {
  text-align: center;
  padding: 1rem;
  background: white;
  border-radius: var(--radius-lg);
  display: inline-block;
}
.qr-display img { display: block; max-width: 280px; width: 100%; height: auto; }

.tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tab-btn {
  padding: 0.6rem 1rem;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  white-space: nowrap;
  flex-shrink: 0;
  min-height: 40px;
}
.tab-btn.active {
  color: var(--text);
  border-bottom-color: var(--primary);
}

.empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-dim);
}

/* ── 그리드(이미지 검색 결과 등) ── */
.grid-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.6rem;
}
@media (max-width: 600px) {
  .grid-tiles { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}

/* ── 카드 안 이미지 ── */
.thumb-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
}

/* ── 게임타입 칩 (아이콘 + 라벨) ── */
.gtype-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--bg-3);
  font-size: 0.78rem;
}
