@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable.min.css');

:root {
  --green-dark:   #2C5F2D;
  --green-mid:    #3D7A3E;
  --green-light:  #97BC62;
  --green-grad:   linear-gradient(135deg, #2C5F2D 0%, #3D7A3E 50%, #97BC62 100%);
  --text-primary: #111111;
  --text-muted:   #6B7280;
  --border:       #E4E4E7;
  --bg-page:      #F8F9FA;
  --white:        #FFFFFF;
}

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

button, input, select, textarea {
  font-family: inherit;
}

body {
  font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans KR', sans-serif;
  background: var(--bg-page);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--text-primary);
  line-height: 1.6;
  padding: 0;
}

/* ===== 매쓰푸 스타일 헤더 ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  height: 57px;
  display: flex;
  align-items: center;
  padding: 0 24px;
}

.site-header-inner {
  max-width: 896px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 32px;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 700;
  font-size: 17px;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.site-logo-bear {
  width: 28px;
  height: 28px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.site-nav-item {
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 6px;
  cursor: pointer;
  background: none;
  border: none;
  transition: color 0.15s, background 0.15s;
}

.site-nav-item:hover {
  color: var(--text-primary);
  background: #F4F4F5;
}

.site-nav-item.active {
  color: var(--green-dark);
  font-weight: 600;
  position: relative;
}

.site-nav-item.active::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 14px;
  right: 14px;
  height: 2px;
  background: var(--green-dark);
  border-radius: 2px;
}

/* ===== 페이지 래퍼 ===== */
.page-wrapper {
  padding: 20px 24px;
  flex: 1;
  min-height: calc(100vh - 57px);
}

/* ===== 페이지 타이틀 ===== */
.page-title-area {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-top: 32px;
}
.page-title-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-left: 4px solid #2C5F2D;
  padding-left: 14px;
}
.page-title-left h1 {
  font-size: 22px;
  font-weight: 700;
  color: #111;
  letter-spacing: -0.02em;
}
.page-title-left p {
  font-size: 14px;
  color: #6B7280;
}

.container {
  max-width: 896px;
  margin: 0 auto;
}

/* Header (페이지 내 배너) */
.header {
  background: var(--green-grad);
  padding: 32px 40px;
  border-radius: 16px;
  text-align: left;
  margin-bottom: 32px;
  color: white;
}

.header h1 {
  color: white;
  margin-bottom: 6px;
  font-size: 1.6em;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.header p {
  color: rgba(255,255,255,0.8);
  font-size: 1em;
  font-weight: 400;
}

/* Section */
.section {
  background: white;
  padding: 32px;
  border-radius: 16px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  border: 1px solid #e2e8f0;
}

.section h2 {
  color: #1a202c;
  margin-bottom: 24px;
  font-size: 1.4em;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Form */
.form-group {
  margin-bottom: 24px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: #2d3748;
  font-weight: 600;
  font-size: 0.95em;
}

input[type="text"],
input[type="datetime-local"],
input[type="file"],
input[type="number"],
select.form-select,
.answer-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 15px;
  transition: all 0.2s;
  background: white;
  color: #1a202c;
}

input[type="text"]:focus,
input[type="datetime-local"]:focus,
input[type="number"]:focus,
select.form-select:focus,
.answer-input:focus {
  outline: none;
  border-color: #3182ce;
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

input[type="text"]::placeholder,
.answer-input::placeholder {
  color: #a0aec0;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* Buttons */
button {
  padding: 12px 24px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin: 4px;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

button:active {
  transform: translateY(0);
}

#checkBtn,
.btn-primary {
  background: var(--green-mid);
  color: white;
  width: 100%;
  margin-top: 12px;
  padding: 14px;
  font-size: 16px;
}

#checkBtn:hover,
.btn-primary:hover {
  background: var(--green-dark);
}

.btn-secondary {
  background: #718096;
  color: white;
}

.btn-secondary:hover {
  background: #4a5568;
}

.btn-danger {
  background: #e53e3e;
  color: white;
}

.btn-danger:hover {
  background: #c53030;
}

#downloadBtn {
  background: #38a169;
  color: white;
  width: 100%;
  margin-top: 20px;
  font-size: 17px;
  padding: 16px;
}

#downloadBtn:hover {
  background: #2f855a;
}

.submissions-btn {
  background: #ed8936 !important;
  color: white;
}

.submissions-btn:hover {
  background: #dd6b20 !important;
}

/* Exam Info */
.exam-info {
  background: #f7fafc;
  padding: 24px;
  border-radius: 12px;
  margin-bottom: 20px;
  border: 1px solid #e2e8f0;
}

.exam-info h2 {
  color: #2d3748;
  margin-bottom: 16px;
  font-size: 1.5em;
}

.exam-info h3 {
  color: #2d3748;
  margin-bottom: 12px;
  font-size: 1.3em;
}

.exam-info p {
  margin: 10px 0;
  color: #4a5568;
  font-size: 1.05em;
}

/* Alerts */
.alert {
  padding: 16px 20px;
  border-radius: 12px;
  margin: 20px 0;
  text-align: center;
  font-weight: 600;
  font-size: 1.05em;
}

.alert-success {
  background: #c6f6d5;
  color: #22543d;
  border: 2px solid #9ae6b4;
}

.alert-warning {
  background: #fef5e7;
  color: #744210;
  border: 2px solid #f6e05e;
}

.alert-error {
  background: #fed7d7;
  color: #742a2a;
  border: 2px solid #fc8181;
}

/* Exam Cards */
.exam-cards {
  display: grid;
  gap: 20px;
}

.exam-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.2s;
  background: white;
}

.exam-card:hover {
  border-color: #cbd5e0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.exam-card-header {
  background: linear-gradient(135deg, #3182ce 0%, #2c5282 100%);
  color: white;
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.exam-card-header h3 {
  margin: 0;
  font-size: 1.25em;
  font-weight: 600;
}

.exam-card-body {
  padding: 24px;
}

.exam-card-body p {
  margin: 12px 0;
  color: #4a5568;
  font-size: 0.95em;
}

.exam-card-body p strong {
  color: #2d3748;
  font-weight: 600;
}

.exam-card-footer {
  padding: 16px 24px;
  background: #f7fafc;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid #e2e8f0;
}

/* Status Badge */
.status-badge {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85em;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.status-waiting {
  background: #fef5e7;
  color: #744210;
}

.status-active {
  background: #c6f6d5;
  color: #22543d;
}

.status-expired {
  background: #fed7d7;
  color: #742a2a;
}

.has-answers-badge {
  display: inline-block;
  padding: 4px 10px;
  background: #38a169;
  color: white;
  border-radius: 12px;
  font-size: 0.8em;
  font-weight: 600;
  margin-left: 8px;
  vertical-align: middle;
}

.code-highlight {
  background: #ebf8ff;
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 700;
  color: #2c5282;
  font-size: 1.15em;
  letter-spacing: 2px;
  font-family: 'Courier New', monospace;
}

/* Paper List */
.paper-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  margin-bottom: 16px;
  background: white;
  transition: all 0.2s;
}

.paper-list-item:hover {
  border-color: #cbd5e0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.paper-info {
  flex: 1;
}

.paper-info h4 {
  margin: 0 0 10px 0;
  color: #2d3748;
  font-size: 1.1em;
  font-weight: 600;
}

.paper-info p {
  margin: 6px 0;
  font-size: 0.9em;
  color: #718096;
}

.paper-info p strong {
  color: #4a5568;
  font-weight: 600;
}

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

/* 시험지 카드 가운데 칸: 배지(정답·해설지·CBT 준비)를 세로로 — 제목 옆에 두면 오른쪽 버튼 칸까지 밀려 나감 */
.paper-list-item { gap: 20px; }
.paper-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  width: 130px;
  flex-shrink: 0;
}
.paper-badges .has-answers-badge { margin-left: 0; white-space: nowrap; }

/* Question Items */
.question-item {
  border: 1px solid #e2e8f0;
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 16px;
  background: #fafafa;
}

.question-header {
  font-weight: 600;
  color: #2c5282;
  margin-bottom: 12px;
  font-size: 1.05em;
}

.question-number {
  font-weight: 700;
  color: #3182ce;
  min-width: 60px;
}

.question-type-select {
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  flex: 1;
}

/* Choice Buttons */
.choice-options {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.choice-btn {
  padding: 12px 24px;
  border: 2px solid #e2e8f0;
  background: white;
  border-radius: 10px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: all 0.2s;
  color: #2d3748;
}

.choice-btn:hover {
  background: #f7fafc;
  border-color: #cbd5e0;
}

.choice-btn.selected {
  border-color: #3182ce;
  background: #3182ce;
  color: white;
}

/* Detail Items */
.detail-item {
  padding: 14px 18px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 10px;
  background: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.detail-item.correct {
  border-left: 4px solid #38a169;
  background: #f0fff4;
}

.detail-item.wrong {
  border-left: 4px solid #e53e3e;
  background: #fff5f5;
}

/* Result Card */
.result-card {
  border: 2px solid #38a169;
  border-radius: 16px;
  padding: 32px;
  background: linear-gradient(135deg, #f0fff4 0%, #c6f6d5 100%);
  text-align: center;
  margin: 24px 0;
}

.result-score {
  font-size: 56px;
  font-weight: 800;
  color: #38a169;
  margin: 20px 0;
  letter-spacing: -0.02em;
}

.result-details {
  margin-top: 24px;
}

.result-details h3 {
  margin-bottom: 16px;
  color: #2d3748;
  font-size: 1.2em;
  font-weight: 600;
  text-align: left;
}

/* No Data */
.no-data {
  text-align: center;
  color: #a0aec0;
  padding: 48px;
  font-size: 1.05em;
}

/* ===== 반응형 — 태블릿 (641~768px) ===== */
@media (max-width: 768px) {
  .page-wrapper {
    padding: 16px;
  }

  .page-title-area {
    padding-top: 20px;
    margin-bottom: 16px;
  }

  .page-title-left h1 {
    font-size: 18px;
  }

  .section {
    padding: 20px;
  }

  .paper-list-item {
    flex-direction: column;
    gap: 16px;
  }

  .paper-badges {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .paper-badges:empty { display: none; }

  .paper-actions {
    width: 100%;
    flex-direction: column;
  }

  .paper-actions button {
    width: 100%;
  }
}

/* ===== 반응형 — 스마트폰 (~640px) ===== */
@media (max-width: 640px) {
  /* 헤더: 가로 스크롤 */
  .site-header {
    padding: 0;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .site-header::-webkit-scrollbar {
    display: none;
  }
  .site-header-inner {
    min-width: max-content;
    padding: 0 16px;
    gap: 16px;
  }

  .site-logo {
    font-size: 15px;
  }

  .site-logo-bear {
    width: 24px;
    height: 24px;
  }

  .site-nav-item {
    padding: 6px 10px;
    font-size: 13px;
  }

  /* 페이지 래퍼 */
  .page-wrapper {
    padding: 12px 16px;
  }

  /* 페이지 타이틀 */
  .page-title-area {
    padding-top: 16px;
    margin-bottom: 14px;
  }

  .page-title-left h1 {
    font-size: 17px;
  }

  .page-title-left p {
    font-size: 12px;
  }

  /* 섹션 */
  .section {
    padding: 16px;
    border-radius: 12px;
  }

  .section h2 {
    font-size: 1.1em;
  }

  /* 폼 */
  .form-group {
    margin-bottom: 16px;
  }

  /* 버튼 */
  button {
    font-size: 14px;
  }

  /* 채점 결과 */
  .result-score {
    font-size: 36px;
  }

  .detail-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}

/* ===== 머리 식히기 ===== */
.breaktime-cards {
  display: flex;
  justify-content: center;
  padding: 32px 0;
}
.breaktime-card {
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  padding: 40px 48px;
  text-align: center;
  max-width: 400px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}
.breaktime-card-icon { font-size: 48px; margin-bottom: 12px; }
.breaktime-card-title { font-size: 22px; font-weight: 700; color: #1a1a1a; margin-bottom: 12px; }
.breaktime-card-desc { font-size: 14px; color: #6B7280; line-height: 1.7; }

/* 24 만들기 게임 */
/* 24만들기 2열 레이아웃 */
.game24-layout {
  display: flex;
  gap: 32px;
  align-items: flex-start;
}
.game24-layout .hof-section {
  flex: 1;
  min-width: 220px;
  margin-top: 0;
  position: sticky;
  top: 20px;
}
@media (max-width: 768px) {
  .game24-layout {
    flex-direction: column;
  }
  .game24-layout .hof-section {
    position: static;
    width: 100%;
  }
}

.game24-wrap {
  flex: 0 0 480px;
  max-width: 480px;
  padding: 8px 0 40px;
}
.game24-score-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 14px;
  color: #374151;
  margin-bottom: 20px;
}
.g24-timer {
  font-size: 13px;
  font-weight: 600;
  color: #6B7280;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
}
/* streak badge 레벨별 스타일 */
#g24Streak {
  display: inline-block;
  padding: 5px 16px;
  border-radius: 20px;
  font-weight: 700;
  min-width: 80px;
  text-align: center;
  transition: background 0.3s, color 0.3s, box-shadow 0.3s;
}
#g24Streak.sl0 { visibility: hidden; }
#g24Streak.sl1 { font-size: 13px; background: #f0f9e8; color: #2C5F2D; }
#g24Streak.sl2 { font-size: 14px; background: #d4edda; color: #1b5e20; }
#g24Streak.sl3 { font-size: 15px; background: #fff3e0; color: #e65100; }
#g24Streak.sl4 { font-size: 16px; background: #fbe9e7; color: #bf360c; box-shadow: 0 0 8px rgba(255,100,0,0.3); }
#g24Streak.sl5 { font-size: 17px; background: #ffccbc; color: #b71c1c; box-shadow: 0 0 14px rgba(255,60,0,0.45); }

@keyframes streakBounce {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.35); }
  65%  { transform: scale(0.92); }
  100% { transform: scale(1); }
}
@keyframes streakPulse {
  0%, 100% { box-shadow: 0 0 14px rgba(255,60,0,0.45); }
  50%       { box-shadow: 0 0 22px rgba(255,60,0,0.75); }
}
.game24-guide {
  text-align: center;
  font-size: 14px;
  color: #6B7280;
  margin-bottom: 20px;
}
.game24-guide strong { color: #1a1a1a; font-size: 18px; }
.game24-nums {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
}
.g24-num-btn {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  border: 2px solid #97BC62;
  background: white;
  font-size: 26px;
  font-weight: 700;
  color: #2C5F2D;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 2px 8px rgba(151,188,98,0.2);
}
.g24-num-btn:hover { background: #f0f7e6; transform: translateY(-2px); }
.g24-num-btn.used { opacity: 0.4; background: #e5e7eb; border-color: #d1d5db; color: #9ca3af; cursor: not-allowed; pointer-events: none; transform: none !important; box-shadow: none !important; }
.game24-display {
  min-height: 58px;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 22px;
  font-weight: 600;
  color: #1a1a1a;
  letter-spacing: 1px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  word-break: break-all;
}
.g24-placeholder { color: #9CA3AF; font-size: 14px; font-weight: 400; }

/* ===== 명예의 전당 섹션 (랜딩) ===== */
.hof-section {
  margin-top: 24px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 20px;
}
.hof-section-title {
  font-size: 16px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 14px;
}
.hof-list { display: flex; flex-direction: column; gap: 8px; }
.hof-item {
  display: grid;
  grid-template-columns: 36px 1fr auto auto;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #f9fafb;
  border-radius: 10px;
  font-size: 14px;
}
.hof-rank { font-size: 18px; text-align: center; }
.hof-name { font-weight: 600; color: #111; }
.hof-time { font-weight: 700; color: #2C5F2D; font-variant-numeric: tabular-nums; }
.hof-date { font-size: 12px; color: #9CA3AF; }
.hof-loading, .hof-empty { font-size: 13px; color: #9CA3AF; text-align: center; display: block; padding: 12px 0; }

/* ===== 명예의 전당 모달 ===== */
.hof-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.hof-modal-box {
  background: #fff;
  border-radius: 20px;
  padding: 36px 28px 28px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  animation: hofModalIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes hofModalIn {
  from { transform: scale(0.85); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}
.hof-modal-trophy { font-size: 52px; margin-bottom: 8px; }
.hof-modal-title { font-size: 20px; font-weight: 800; color: #1a1a1a; margin: 0 0 4px; }
.hof-modal-sub { font-size: 14px; color: #6B7280; margin: 0 0 4px; }
.hof-modal-time { font-size: 15px; color: #374151; margin: 0 0 20px; }
.hof-modal-time strong { color: #2C5F2D; font-size: 18px; }
.hof-name-input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 16px;
  text-align: center;
  outline: none;
  box-sizing: border-box;
  margin-bottom: 16px;
  transition: border-color 0.2s;
}
.hof-name-input:focus { border-color: #97BC62; }
.hof-modal-btns { display: flex; gap: 10px; }
.hof-modal-btns button { flex: 1; }
.game24-ops {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.g24-op-btn {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: white;
  font-size: 20px;
  font-weight: 600;
  color: #374151;
  cursor: pointer;
  transition: all 0.12s;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
}
.g24-op-btn:hover { background: #f0f7e6; border-color: #97BC62; }
.g24-back { color: #E53E3E; border-color: #fecaca; }
.g24-back:hover { background: #fff5f5; border-color: #E53E3E; }
.game24-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 16px;
}
.g24-clear-btn {
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: white;
  font-size: 14px;
  color: #6B7280;
  cursor: pointer;
}
.g24-clear-btn:hover { background: #f5f5f5; }
.g24-feedback {
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  min-height: 28px;
  padding: 8px;
  border-radius: 8px;
}
.g24-feedback.success { color: #2C5F2D; background: #f0f7e6; }
.g24-feedback.error   { color: #E53E3E; background: #fff5f5; }

/* ===== 푸터 ===== */
.site-footer {
  border-top: 1px solid #E4E4E7;
  background: #FAFAFA;
  padding: 28px 24px 32px;
  margin-top: auto;
}
.site-footer-inner {
  max-width: 896px;
  margin: 0 auto;
}
.site-footer-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.site-footer-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1rem;
}

/* ===== 도형 맞추기 (테트로미노 퍼즐) ===== */
:root {
  --tet-cell: 52px;   /* 그리드 셀 크기 (데스크탑) */
  --tet-mini: 26px;   /* 조각 패널 미니 셀 크기 */
}

.tetromino-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.tetromino-level-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--green-dark);
  background: #EAF3EA;
  border: 1px solid #CFE3CF;
  border-radius: 999px;
  padding: 4px 14px;
}

.tetromino-body {
  display: flex;
  align-items: flex-start;
  gap: 32px;
  flex-wrap: wrap;
}

.tetromino-grid-wrap {
  flex-shrink: 0;
}

.tetromino-grid {
  display: grid;
  gap: 4px; /* game-tetromino.js 의 GRID_GAP 과 동일해야 함 */
  background: #E8ECF1;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  width: max-content;
  touch-action: none;
}

.tetromino-cell {
  width: var(--tet-cell);
  height: var(--tet-cell);
  background: var(--white);
  border: 1.5px dashed #CBD5E0;
  border-radius: 6px;
  box-sizing: border-box;
}

.tetromino-cell.fixed {
  background: #8E99A8;
  border: 1.5px solid #7B8694;
  background-image: linear-gradient(135deg, rgba(255,255,255,0.12) 0%, rgba(0,0,0,0.08) 100%);
}

.tetromino-cell.filled {
  border: none;
  cursor: grab;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.25);
}

.tetromino-cell.ghost-ok {
  background: #C6F6D5 !important;
  border: 1.5px solid #48BB78 !important;
  box-shadow: none;
}

.tetromino-cell.ghost-bad {
  background: #FED7D7 !important;
  border: 1.5px solid #F56565 !important;
  box-shadow: none;
}

.tetromino-sidebar {
  flex: 1;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tetromino-pieces-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.tetromino-pieces-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  align-content: flex-start;
  gap: 18px;
  min-height: 96px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.tetromino-piece {
  display: grid;
  gap: 3px;
  cursor: grab;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.tetromino-piece:active {
  cursor: grabbing;
}

.tetromino-piece-cell {
  width: var(--tet-mini);
  height: var(--tet-mini);
  border-radius: 5px;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.15);
}

.tetromino-piece-cell.empty {
  background: transparent;
  box-shadow: none;
}

.tetromino-panel-empty {
  font-size: 14px;
  color: var(--text-muted);
  align-self: center;
  margin: auto;
}

.tetromino-actions {
  display: flex;
  gap: 10px;
}

.tetromino-feedback {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
  min-height: 22px;
}

.tetromino-feedback.success {
  color: var(--green-dark);
  font-weight: 700;
}

.tetromino-restart-btn {
  margin-top: 10px;
}

.tetromino-ghost {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  display: grid;
  opacity: 0.85;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.25));
}

@media (max-width: 640px) {
  :root {
    --tet-cell: 40px;
    --tet-mini: 22px;
  }
  .tetromino-body {
    flex-direction: column;
    align-items: center;
    gap: 20px;
  }
  .tetromino-grid-wrap {
    display: flex;
    justify-content: center;
  }
  .tetromino-sidebar {
    width: 100%;
    min-width: 0;
  }
  .tetromino-pieces-panel {
    justify-content: center;
  }
}
