/* 색상·글꼴·크기 값은 js/config.js 의 theme 에서 CSS 변수로 주입됩니다. */
:root {
  --bg: #f4f9fd;
  --text: #1c2733;
  --sub: #5b6b7a;
  --accent: #2f7fd1;
  --btn-bg: #fff;
  --btn-border: #c9d6e3;
  --video-bg: #000;
  --font: -apple-system, "Apple SD Gothic Neo", sans-serif;
  --word-size: 30px;
  --name-size: 17px;
  --desc-size: 12.5px;
  --menu-size: 16px;
  --video-size: 176px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-text-size-adjust: 100%;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
body { position: fixed; inset: 0; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
}

/* ---------- 무대 ---------- */
#stage {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;          /* JS 에서 translate + scale 지정 */
}

/* ---------- 상단 비교 메뉴 ---------- */
#menu {
  position: absolute;
  display: flex;
  justify-content: center;
}
.menu-btn {
  height: 100%;
  padding: 0 22px;
  font-size: var(--menu-size);
  background: var(--btn-bg);
  border: 1.5px solid var(--btn-border);
  border-radius: 22px;
}
.menu-btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ---------- 단어 칸 ---------- */
.cell {
  position: absolute;             /* 고정 위치: 열고 닫아도 이동하지 않음 */
  display: block;
  overflow: hidden;
}
.cell .word {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--word-size);
  font-weight: 600;
}
.cell .open {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  padding-top: 4px;
}
.cell.is-open .word { display: none; }
.cell.is-open .open { display: flex; }

.cell .frame {
  position: relative;
  width: var(--video-size);
  height: var(--video-size);
  flex: none;
  background: var(--video-bg);
}
.cell video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;           /* 터치는 칸(button)이 받음 */
}
/* iOS 기본 재생 버튼 오버레이 숨김 */
.cell video::-webkit-media-controls,
.cell video::-webkit-media-controls-start-playback-button,
.cell video::-webkit-media-controls-panel { display: none !important; -webkit-appearance: none; }

.cell .name {
  margin-top: 6px;
  font-size: var(--name-size);
  font-weight: 600;
}
.cell .desc {
  margin-top: 2px;
  max-width: 250px;
  font-size: var(--desc-size);
  line-height: 1.35;
  color: var(--sub);
  text-align: center;
  word-break: keep-all;
}
/* 재생 실패 표시 (숨기지 않고 화면에 노출) */
.cell .fail {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 3px 4px;
  font-size: 11px;
  background: #c62828;
  color: #fff;
  display: none;
}
.cell.is-failed .fail { display: block; }

/* ---------- 전체 열기 / 닫기 ---------- */
.controls {
  position: absolute;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 14px;
}
.ctrl-btn {
  width: 150px;
  height: 48px;
  font-size: 16px;
  background: var(--btn-bg);
  border: 1.5px solid var(--btn-border);
  border-radius: 10px;
}
.ctrl-btn:active, .menu-btn:active { opacity: .6; }

/* ---------- 디버그 ---------- */
#debug-toggle {
  position: fixed;
  right: 6px;
  bottom: 6px;
  z-index: 20;
  padding: 3px 7px;
  font-size: 10px;
  font-family: ui-monospace, Menlo, monospace;
  color: #8796a5;
  border: 1px solid #c9d6e3;
  border-radius: 4px;
  background: rgba(255,255,255,.7);
}
#debug-panel {
  position: fixed;
  right: 6px;
  bottom: 32px;
  z-index: 19;
  width: 470px;
  max-height: calc(100% - 44px);
  overflow: auto;
  padding: 8px 10px;
  background: rgba(0,0,0,.72);
  color: #e8f0f8;
  font: 11px/1.4 ui-monospace, Menlo, monospace;
  border-radius: 6px;
  white-space: pre-wrap;
  pointer-events: none;           /* 패널 아래 단어/버튼도 그대로 터치 가능 */
}
#debug-panel[hidden] { display: none; }
#debug-panel .bad { color: #ff8a80; }
#debug-panel .ok { color: #9be89b; }
