:root {
  color-scheme: dark;
  --bg: #070b12;
  --panel: rgba(17, 24, 39, 0.82);
  --panel-strong: rgba(22, 31, 49, 0.94);
  --card: rgba(17, 24, 39, 0.82);
  --card-hover: rgba(22, 31, 49, 0.94);
  --line: rgba(151, 166, 195, 0.22);
  --text: #f4f7fb;
  --muted: #9aa8bd;
  --accent: #45a3ff;
  --accent-strong: #9ccfff;
  --mint: #26e0b8;
  --coral: #ff7a6b;
  --warning: #f7c948;
  --danger: #ff6b7d;
  --approved: #26e0b8;
  --review: #9ccfff;
  --soft: rgba(255, 255, 255, 0.07);
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.44);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 14% 10%, rgba(69, 163, 255, 0.28), transparent 30%),
    radial-gradient(circle at 88% 18%, rgba(38, 224, 184, 0.18), transparent 28%),
    radial-gradient(circle at 58% 92%, rgba(255, 122, 107, 0.15), transparent 32%),
    linear-gradient(135deg, #070b12 0%, #0c1320 44%, #101721 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Segoe UI", sans-serif;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), transparent 82%);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1760px, calc(100% - 16px));
  margin: 0 auto;
  padding: 16px 0 36px;
}

.topbar,
.panel,
.modal-content {
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.085), rgba(255, 255, 255, 0.035)),
    var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 10px 18px;
  border-radius: 8px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(36px, 5.2vw, 56px);
  line-height: 1.1;
  letter-spacing: 0;
  text-shadow: 0 0 36px rgba(69, 163, 255, 0.12);
}

.topbar .eyebrow {
  margin-bottom: 4px;
  font-size: 10px;
}

.topbar h1 {
  margin-bottom: 4px;
  font-size: clamp(24px, 3vw, 34px);
}

.topbar .subtitle {
  margin-bottom: 0;
  font-size: 0.9rem;
}

h2,
h3 {
  margin-bottom: 0;
}

h4 {
  margin-bottom: 14px;
  font-size: 1rem;
}

.subtitle,
.muted {
  color: var(--muted);
}

.dashboard {
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  gap: 14px;
  margin-top: 14px;
  min-height: 0;
}

.panel {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 160px);
  max-height: calc(100vh - 160px);
  border-radius: 8px;
  padding: 18px;
  overflow: hidden;
}

.panel-header,
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
}

.card-list,
.student-grid,
.settings-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.card-list,
.student-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 4px 2px 0;
  scrollbar-color: rgba(156, 207, 255, 0.42) rgba(255, 255, 255, 0.06);
  scrollbar-width: thin;
}

.student-grid {
  align-content: start;
  align-items: start;
  grid-template-columns: repeat(5, minmax(176px, 1fr));
  grid-auto-rows: max-content;
}

.homework-card,
.student-card,
.settings-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.085), rgba(255, 255, 255, 0.035)),
    var(--card);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(18px);
}

.homework-card,
.student-card {
  padding: 14px;
  transition: background 160ms ease, transform 160ms ease, border-color 160ms ease;
}

.homework-card:hover,
.student-card:hover {
  border-color: var(--accent);
  background:
    linear-gradient(180deg, rgba(69, 163, 255, 0.16), rgba(38, 224, 184, 0.075)),
    var(--card-hover);
  box-shadow: 0 24px 70px rgba(69, 163, 255, 0.18);
  transform: translateY(-2px);
}

.homework-card.active {
  border-color: var(--mint);
  background:
    linear-gradient(180deg, rgba(38, 224, 184, 0.16), rgba(69, 163, 255, 0.08)),
    var(--card-hover);
  box-shadow: 0 24px 70px rgba(38, 224, 184, 0.18);
}

.homework-title-row,
.student-title-row,
.reward-row,
.status-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.homework-card h3,
.student-card h3 {
  margin: 0;
  font-size: 1rem;
}

.student-name-row {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.homework-card p,
.student-card p {
  color: var(--muted);
  line-height: 1.5;
}

.submission-count {
  margin: 0;
  min-height: 24px;
}

.submission-count.is-hidden {
  visibility: hidden;
}

.submission-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 30px;
  margin-top: 8px;
}

.submission-line .level-pill {
  flex: 0 0 auto;
}

.date-row {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.86rem;
}

.homework-meta-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-top: 12px;
}

.homework-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.pill,
.status-pill,
.coupon,
.level-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.pill {
  border-color: rgba(156, 207, 255, 0.34);
  background: rgba(69, 163, 255, 0.14);
  color: #cfe8ff;
}

.status-pending {
  border-color: rgba(247, 201, 72, 0.52);
  background: rgba(247, 201, 72, 0.12);
  color: #ffd96f;
}

.status-review {
  border-color: rgba(156, 207, 255, 0.48);
  background: rgba(69, 163, 255, 0.14);
  color: #cfe8ff;
}

.status-approved {
  border-color: rgba(38, 224, 184, 0.52);
  background: rgba(38, 224, 184, 0.12);
  color: #55f0d0;
}

.coupon-row,
.star-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.coupon-row {
  min-height: 30px;
}

.coupon-row.is-hidden {
  visibility: hidden;
}

.star-row {
  min-height: 28px;
}

.star-row.is-hidden {
  visibility: hidden;
}

.student-card .star-row {
  margin-top: 10px;
}

.student-card .coupon-row {
  align-items: flex-start;
  gap: 8px;
  margin-top: 10px;
}

.star-row img,
.coupon img,
.reward-preview img {
  width: 22px;
  height: 22px;
}

.coupon {
  gap: 6px;
  max-width: 100%;
  border-color: rgba(247, 201, 72, 0.52);
  background: rgba(247, 201, 72, 0.12);
  color: #ffd96f;
}

.coupon img {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  object-fit: cover;
}

.coupon:nth-child(2n) {
  border-color: rgba(255, 122, 107, 0.48);
  background: rgba(255, 122, 107, 0.12);
  color: #ffad9f;
}

.coupon:nth-child(3n) {
  border-color: rgba(69, 163, 255, 0.48);
  background: rgba(69, 163, 255, 0.14);
  color: #cfe8ff;
}

.coupon:nth-child(4n) {
  border-color: rgba(38, 224, 184, 0.52);
  background: rgba(38, 224, 184, 0.12);
  color: #55f0d0;
}

.level-pill {
  border-color: rgba(38, 224, 184, 0.52);
  background: rgba(38, 224, 184, 0.12);
  color: #55f0d0;
}

.level-초급 {
  border-color: rgba(156, 207, 255, 0.48);
  background: rgba(69, 163, 255, 0.14);
  color: #cfe8ff;
}

.level-중급 {
  border-color: rgba(247, 201, 72, 0.52);
  background: rgba(247, 201, 72, 0.12);
  color: #ffd96f;
}

.level-고급 {
  border-color: rgba(255, 122, 107, 0.48);
  background: rgba(255, 122, 107, 0.12);
  color: #ffad9f;
}

.level-특급 {
  border-color: rgba(38, 224, 184, 0.52);
  background: rgba(38, 224, 184, 0.12);
  color: #55f0d0;
}

.exposure-switch {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button,
.segmented button {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid var(--line);
  color: var(--text);
}

.primary-button {
  background: linear-gradient(135deg, var(--mint), var(--accent));
  border-color: transparent;
  color: #061019;
  font-weight: 800;
  box-shadow: 0 14px 36px rgba(69, 163, 255, 0.26);
}

.secondary-button {
  background: rgba(255, 255, 255, 0.06);
}

.ghost-button,
.icon-button {
  background: rgba(255, 255, 255, 0.06);
}

.icon-button {
  width: 44px;
  font-size: 1.35rem;
}

.segmented {
  display: inline-flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  backdrop-filter: blur(18px);
}

.segmented button {
  border: 0;
  background: transparent;
  padding: 0 12px;
  color: var(--muted);
}

.segmented button.active {
  background: linear-gradient(135deg, var(--mint), var(--accent));
  color: #061019;
  font-weight: 800;
}

.segmented button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.segmented button:disabled.active {
  background: transparent;
  color: var(--muted);
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  box-shadow: none;
}

.homework-actions .secondary-button,
.homework-actions .ghost-button {
  min-height: 32px;
  padding: 0 12px;
  font-size: 0.82rem;
  font-weight: 800;
}

.danger-button {
  border-color: rgba(255, 122, 107, 0.48);
  background: rgba(255, 122, 107, 0.12);
  color: #ffad9f;
}

.switch {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  width: 50px;
  height: 28px;
}

.switch input {
  opacity: 0;
}

.slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #344255;
}

.slider::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #dfe8f4;
  transition: transform 150ms ease;
}

.switch input:checked + .slider {
  background: var(--accent);
}

.switch input:checked + .slider::after {
  transform: translateX(22px);
}

.modal {
  width: min(680px, calc(100vw - 32px));
  border: 0;
  padding: 0;
  background: transparent;
}

.wide-modal {
  width: min(1080px, calc(100vw - 32px));
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.66);
  backdrop-filter: blur(6px);
}

.modal-content {
  display: grid;
  gap: 16px;
  padding: 22px;
  border-radius: 8px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.half-field {
  width: calc(50% - 7px);
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 11, 18, 0.78);
  color: var(--text);
  padding: 11px 12px;
  outline: none;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(69, 163, 255, 0.14);
}

.form-grid,
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.switch-row,
.check-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.check-row {
  justify-content: flex-start;
}

.check-row input {
  width: auto;
}

.submission-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.empty-submission {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.055);
}

.submission-thumb {
  flex: 0 0 140px;
  aspect-ratio: 4 / 3;
  border: 2px solid transparent;
  border-radius: 8px;
  background: rgba(7, 11, 18, 0.78);
  object-fit: cover;
}

.submission-thumb.active {
  border-color: var(--accent);
}

.preview-frame {
  display: grid;
  place-items: center;
  min-height: 430px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.018)),
    rgba(7, 11, 18, 0.78);
}

.preview-frame img {
  max-width: 100%;
  max-height: 68vh;
  border-radius: 8px;
}

.preview-frame img:not([src]) {
  display: none;
}

.settings-content {
  max-height: 88vh;
  overflow: auto;
}

.settings-grid section {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.085), rgba(255, 255, 255, 0.035)),
    var(--panel);
  backdrop-filter: blur(18px);
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(90px, 120px) auto;
  gap: 8px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
}

.settings-row .status-pending,
.settings-row .status-review,
.settings-row .status-approved {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.coupon-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.reward-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

@media (max-width: 940px) {
  .dashboard,
  .form-grid,
  .settings-grid,
  .half-field {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .panel {
    min-height: auto;
  }

  .panel-header,
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .segmented {
    width: 100%;
    overflow-x: auto;
  }

  .segmented button {
    flex: 1 0 auto;
  }
}

@media (max-width: 1380px) {
  .student-grid {
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  }
}
