* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  background: #0b1220;
  color: #e5e7eb;
  font-family: system-ui, -apple-system, "Segoe UI", "Malgun Gothic", sans-serif;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  justify-content: center;
}

.game {
  display: flex;
  flex-direction: column;
  width: min(920px, 100%);
  height: 100%;
  padding: 10px;
  gap: 8px;
}

.hud {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 16px;
  flex: 0 0 auto;
}

.stat {
  font-size: 14px;
  color: #94a3b8;
  white-space: nowrap;
}

.stat strong {
  color: #f8fafc;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.user-name {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  font-weight: 600;
  color: #93c5fd;
  white-space: nowrap;
}

.user-name:not(:empty)::after {
  content: '님';
  color: #64748b;
  font-weight: 400;
}

.user-name.admin::after {
  content: ' · 관리자';
  color: #fbbf24;
  font-weight: 600;
}

.user-name:empty { display: none; }

#startBtn {
  margin-left: auto;
  padding: 8px 18px;
  font: inherit;
  font-weight: 600;
  color: #f8fafc;
  background: #2563eb;
  border: 1px solid #3b82f6;
  border-radius: 10px;
  cursor: pointer;
}

#startBtn:hover { background: #1d4ed8; }
#startBtn:active { transform: translateY(1px); }
#startBtn:focus-visible { outline: 2px solid #93c5fd; outline-offset: 2px; }

.play {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  gap: 10px;
}

.stage {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
}

.album {
  flex: 0 0 172px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 8px;
  background: #0f1726;
  border: 1px solid #27354a;
  border-radius: 12px;
}

.album-title {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: #94a3b8;
}

.album-list {
  list-style: none;
  margin: 0;
  padding: 0 2px 0 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.album-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 6px;
  background: #141c2b;
  border: 1px solid transparent;
  border-radius: 8px;
}

.album-item.current {
  background: #1d2b45;
  border-color: #3b82f6;
}

.album-index {
  flex: 0 0 16px;
  font-size: 11px;
  text-align: right;
  color: #64748b;
  font-variant-numeric: tabular-nums;
}

.album-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.album-name {
  font-size: 13px;
  font-weight: 600;
  color: #e2e8f0;
  white-space: nowrap;
}

/* 아직 정답을 맞히지 못한 도형은 이름을 가리고 자물쇠만 보여 줍니다.
   정답을 맞히면 자물쇠가 풀리고 이름이 보입니다. */
.album-item:not(.revealed) .album-name {
  position: relative;
  color: transparent;
}

.album-item:not(.revealed) .album-name::after {
  content: '🔒';
  position: absolute;
  left: 0;
  top: 0;
  color: #94a3b8;
}

.album-item.revealed .album-name { color: #93c5fd; }

@media (max-width: 760px) {
  .play { flex-direction: column; }

  .album {
    flex: 0 0 auto;
    max-height: 104px;
  }

  .album-list {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .album-item { flex: 0 0 auto; }
}

#board {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: pointer;
}

.ranking-status {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 4px;
  margin: 0;
  text-align: center;
  font-size: 14px;
  line-height: 1.4;
  color: #93c5fd;
  pointer-events: none;
}

.ranking-status:empty { display: none; }

#makerBtn {
  margin-left: auto;
  padding: 8px 14px;
  font: inherit;
  font-weight: 600;
  color: #cbd5e1;
  background: #1b2433;
  border: 1px solid #334155;
  border-radius: 10px;
  cursor: pointer;
}

#makerBtn:hover { background: #243043; }

#adminBtn {
  padding: 8px 14px;
  font: inherit;
  font-weight: 600;
  color: #fde68a;
  background: #3a2b10;
  border: 1px solid #b45309;
  border-radius: 10px;
  cursor: pointer;
}

#adminBtn:hover { background: #4a3615; }

.admin-body { grid-template-columns: minmax(0, 1fr); }

#startBtn { margin-left: 8px; }

.maker {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  background: #0b1220;
}

.maker[hidden] { display: none; }

.maker-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  gap: 10px;
  padding: 16px;
  background: #0f1726;
}

.maker-body {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  overflow: hidden;
}

.maker-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
}

.maker-library {
  padding-left: 20px;
  border-left: 1px solid #27354a;
}

.maker-head { flex: 0 0 auto; }

@media (max-width: 760px) {
  .maker-body {
    grid-template-columns: minmax(0, 1fr);
    grid-auto-rows: min-content;
    overflow-y: auto;
  }

  .maker-col { overflow: visible; }

  .maker-library {
    padding-left: 0;
    padding-top: 12px;
    border-left: 0;
    border-top: 1px solid #27354a;
  }
}

.maker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex: 0 0 auto;
}

.maker-title { margin: 0; font-size: 18px; }

.maker-help {
  margin: 8px 0 12px;
  font-size: 13px;
  line-height: 1.5;
  color: #94a3b8;
}

.maker-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: #94a3b8;
}

.maker-field input {
  padding: 8px 10px;
  font: inherit;
  color: #f8fafc;
  background: #131b29;
  border: 1px solid #334155;
  border-radius: 8px;
}

.maker-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.maker-swatch {
  padding: 7px 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: #cbd5e1;
  background: #16202f;
  border: 2px solid #334155;
  border-radius: 999px;
  cursor: pointer;
}

.maker-swatch.on { color: #0b1220; }

.maker-grid {
  display: block;
  width: 100%;
  max-width: 360px;
  height: auto;
  margin: 0 auto;
  border: 1px solid #27354a;
  border-radius: 10px;
  touch-action: none;
  cursor: pointer;
}

.maker-info {
  margin: 10px 0;
  font-size: 13px;
  color: #93c5fd;
  text-align: center;
}

.maker-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.maker-tools button {
  flex: 1 1 auto;
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
}

.maker-actions { display: flex; gap: 8px; }

.maker-actions button {
  flex: 1 1 auto;
  padding: 10px;
  font: inherit;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
}

button.primary {
  color: #f8fafc;
  background: #2563eb;
  border: 1px solid #3b82f6;
}

button.primary:hover { background: #1d4ed8; }

button.ghost {
  color: #cbd5e1;
  background: #1b2433;
  border: 1px solid #334155;
}

button.ghost:hover { background: #243043; }

.maker-status {
  min-height: 1.2em;
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.4;
  color: #fbbf24;
}

.maker-sub { margin: 16px 0 8px; font-size: 14px; color: #94a3b8; }

.maker-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.maker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: #141c2b;
  border: 1px solid #27354a;
  border-radius: 10px;
  font-size: 13px;
}

.maker-item-name { font-weight: 600; color: #e2e8f0; }
.maker-item-info { flex: 1 1 auto; color: #94a3b8; font-size: 12px; }

.maker-item button {
  padding: 6px 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: #f8fafc;
  background: #2563eb;
  border: 1px solid #3b82f6;
  border-radius: 8px;
  cursor: pointer;
}

.maker-item button.danger {
  background: #7f1d1d;
  border-color: #b91c1c;
}

.maker-item button.danger:hover { background: #991b1b; }

.maker-empty { padding: 4px; font-size: 13px; color: #64748b; }
