:root {
  --ink: #0c1720;
  --navy: #071b2b;
  --blue: #0f5fe7;
  --cyan: #65e2ff;
  --paper: #f3f0e8;
  --line: rgba(12, 23, 32, 0.16);
  --muted: #61707a;
  --white: #fff;
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(rgba(12, 23, 32, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(12, 23, 32, 0.045) 1px, transparent 1px),
    var(--paper);
  background-size: 42px 42px;
}

button, input { font: inherit; }
button { cursor: pointer; }

.page-shell {
  width: min(1180px, calc(100% - 36px));
  margin: 18px auto;
  border: 1px solid var(--ink);
  background: rgba(243, 240, 232, 0.94);
  box-shadow: 10px 10px 0 rgba(7, 27, 43, 0.11);
}

.hero {
  position: relative;
  overflow: hidden;
  min-height: 390px;
  padding: 28px 38px 34px;
  color: var(--white);
  background:
    radial-gradient(circle at 82% 12%, rgba(101, 226, 255, 0.23), transparent 24%),
    linear-gradient(125deg, #061824 0%, #092b46 70%, #0c4c70 100%);
}

.hero::after {
  content: "{ }";
  position: absolute;
  right: 3%;
  bottom: -21%;
  font-family: Consolas, monospace;
  font-size: clamp(210px, 28vw, 390px);
  font-weight: 700;
  letter-spacing: -0.18em;
  color: transparent;
  -webkit-text-stroke: 1px rgba(101, 226, 255, 0.17);
  transform: rotate(-5deg);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font: 700 11px/1 Consolas, monospace;
  letter-spacing: 0.18em;
  color: rgba(255,255,255,.7);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--cyan);
  color: var(--white);
  font-size: 20px;
  letter-spacing: 0;
}

.brand-mark span { color: var(--cyan); }

.hero-copy {
  position: relative;
  z-index: 1;
  margin: 62px 0 54px;
}

.eyebrow, .step-label {
  margin: 0 0 12px;
  color: var(--blue);
  font: 700 11px/1 Consolas, monospace;
  letter-spacing: .18em;
}

.hero .eyebrow { color: var(--cyan); }

h1 {
  margin: 0;
  font-size: clamp(42px, 6.3vw, 82px);
  line-height: .98;
  letter-spacing: -.055em;
}

h1 em {
  color: var(--cyan);
  font-style: normal;
  font-weight: 300;
}

.intro {
  width: min(520px, 100%);
  margin: 25px 0 0;
  color: rgba(255,255,255,.68);
  line-height: 1.75;
}

.course-meta {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid rgba(255,255,255,.18);
}

.course-meta div {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px 22px 0 0;
}

.course-meta span {
  color: rgba(255,255,255,.48);
  font-size: 12px;
}

.course-meta strong {
  font: 700 14px/1.2 Consolas, monospace;
  letter-spacing: .08em;
}

main { padding: 0 38px; }

.booking-panel, .form-panel, .lookup-panel { padding: 55px 0; }
.form-panel, .lookup-panel { border-top: 1px solid var(--line); }

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 30px;
}

h2 {
  margin: 0;
  font-size: clamp(27px, 3vw, 38px);
  letter-spacing: -.035em;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  color: var(--muted);
  font-size: 12px;
}

.legend span { display: flex; align-items: center; gap: 7px; }
.dot { width: 8px; height: 8px; border-radius: 50%; }
.dot.available { background: var(--white); border: 1px solid var(--ink); }
.dot.selected { background: var(--blue); }
.dot.occupied { background: #a7adaf; }

.schedule { display: grid; gap: 18px; }

.day-row {
  display: grid;
  grid-template-columns: 142px 1fr;
  border-top: 1px solid var(--ink);
  padding-top: 16px;
}

.day-title strong {
  display: block;
  font: 700 22px/1 Consolas, monospace;
}

.day-title span {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.slots {
  display: grid;
  grid-template-columns: repeat(8, minmax(76px, 1fr));
  gap: 8px;
}

.slot {
  min-height: 54px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.55);
  color: var(--ink);
  font: 700 13px/1 Consolas, monospace;
  transition: .18s ease;
}

.slot:hover:not(:disabled) {
  border-color: var(--blue);
  color: var(--blue);
  transform: translateY(-2px);
}

.slot.is-selected {
  border-color: var(--blue);
  background: var(--blue);
  color: var(--white);
  box-shadow: 4px 4px 0 #082f79;
}

.slot:disabled {
  cursor: not-allowed;
  border-color: transparent;
  background: rgba(12,23,32,.07);
  color: #969d9f;
  text-decoration: line-through;
}

.notice {
  margin: -10px 0 24px;
  padding: 14px 17px;
  border-left: 3px solid var(--blue);
  background: rgba(15,95,231,.08);
  color: #174785;
  line-height: 1.5;
}

.notice.error {
  border-color: #d74242;
  background: rgba(215,66,66,.08);
  color: #8a2525;
}

.loading { padding: 35px 0; color: var(--muted); }

.selection-summary {
  margin: 0;
  color: var(--muted);
  font: 700 13px/1.5 Consolas, monospace;
}

.selection-summary.active { color: var(--blue); }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px 34px;
}

label > span {
  display: block;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 700;
}

input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid #8d9598;
  border-radius: 0;
  padding: 13px 2px;
  outline: none;
  background: transparent;
  transition: border-color .18s;
}

input:focus { border-bottom: 2px solid var(--blue); }
input.invalid { border-color: #d74242; }

label small {
  display: block;
  min-height: 18px;
  padding-top: 5px;
  color: #b52e2e;
  font-size: 11px;
}

.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 30px;
}

.form-footer p { color: var(--muted); font-size: 12px; }

#submit-button, dialog button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 44px;
  min-width: 210px;
  border: 1px solid var(--navy);
  padding: 16px 18px;
  background: var(--navy);
  color: var(--white);
  font-weight: 700;
}

#submit-button:hover:not(:disabled), dialog button:hover { background: var(--blue); border-color: var(--blue); }
#submit-button:disabled { cursor: not-allowed; opacity: .38; }

.lookup-form {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 24px;
}

.lookup-form button {
  min-width: 170px;
  border: 1px solid var(--navy);
  padding: 15px 20px;
  background: var(--navy);
  color: white;
  font-weight: 700;
}

.lookup-result {
  margin-top: 24px;
  border-left: 3px solid var(--blue);
  padding: 18px 22px;
  background: rgba(15,95,231,.08);
  line-height: 1.8;
}

.lookup-result.error {
  border-color: #d74242;
  background: rgba(215,66,66,.08);
  color: #8a2525;
}

footer {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--ink);
  padding: 17px 38px;
  color: var(--muted);
  font: 700 10px/1 Consolas, monospace;
  letter-spacing: .12em;
}

dialog {
  width: min(450px, calc(100% - 36px));
  border: 1px solid var(--navy);
  padding: 42px;
  text-align: center;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 12px 12px 0 rgba(7,27,43,.25);
}

dialog::backdrop { background: rgba(3,15,24,.72); backdrop-filter: blur(3px); }
.success-icon {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  margin: 0 auto 24px;
  border-radius: 50%;
  background: var(--blue);
  color: white;
  font-size: 30px;
}
dialog p:not(.step-label) { color: var(--muted); line-height: 1.7; }
dialog button { margin: 27px auto 0; min-width: 150px; display: block; }

@media (max-width: 800px) {
  .page-shell { width: calc(100% - 20px); margin: 10px auto; }
  .hero, main { padding-left: 22px; padding-right: 22px; }
  .hero { min-height: auto; }
  .hero-copy { margin: 48px 0; }
  .course-meta { grid-template-columns: 1fr; }
  .course-meta div { flex-direction: row; justify-content: space-between; padding-top: 14px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .day-row { grid-template-columns: 1fr; gap: 14px; }
  .slots { grid-template-columns: repeat(3, 1fr); }
  .form-grid { grid-template-columns: 1fr; gap: 16px; }
  .form-footer { align-items: stretch; flex-direction: column; }
  .lookup-form { grid-template-columns: 1fr; }
  .lookup-form button { width: 100%; }
  #submit-button { width: 100%; }
}

.admin-shell {
  width: min(1280px, calc(100% - 36px));
  margin: 18px auto;
}

.admin-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 34px 38px;
  color: white;
  background: var(--navy);
}

.admin-header h1 { font-size: clamp(34px, 5vw, 62px); }
.admin-header .eyebrow { color: var(--cyan); }
.admin-actions { display: flex; gap: 10px; }

.secondary-button {
  border: 1px solid rgba(255,255,255,.45);
  padding: 11px 15px;
  background: transparent;
  color: white;
}

.admin-content {
  border: 1px solid var(--ink);
  border-top: 0;
  padding: 34px 38px 44px;
  background: rgba(243,240,232,.96);
}

.login-card {
  width: min(430px, 100%);
  margin: 45px auto;
  border-top: 1px solid var(--ink);
  padding-top: 28px;
}

.login-card label { display: block; margin-bottom: 20px; }
.login-card button { width: 100%; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

.stat {
  border: 1px solid var(--line);
  padding: 20px;
  background: rgba(255,255,255,.55);
}

.stat span { display: block; color: var(--muted); font-size: 12px; }
.stat strong { display: block; margin-top: 8px; font: 700 28px/1 Consolas, monospace; }

.table-wrap { overflow-x: auto; border-top: 1px solid var(--ink); }
.booking-table { width: 100%; border-collapse: collapse; min-width: 930px; }
.booking-table th, .booking-table td { padding: 15px 12px; border-bottom: 1px solid var(--line); text-align: left; font-size: 13px; }
.booking-table th { color: var(--muted); font-size: 11px; letter-spacing: .08em; }
.booking-table td:first-child { font-family: Consolas, monospace; font-weight: 700; color: var(--blue); }
.empty-state { padding: 55px 10px; text-align: center; color: var(--muted); }
.return-button {
  border: 1px solid #b52e2e;
  padding: 8px 12px;
  background: transparent;
  color: #9f2929;
  white-space: nowrap;
}
.return-button:hover { background: #b52e2e; color: white; }

@media (max-width: 700px) {
  .admin-shell { width: calc(100% - 20px); margin: 10px auto; }
  .admin-header { align-items: flex-start; flex-direction: column; padding: 25px 22px; }
  .admin-content { padding: 25px 22px 35px; }
  .stats { grid-template-columns: 1fr; }
}

@media (max-width: 430px) {
  h1 { font-size: 38px; }
  .slots { grid-template-columns: repeat(2, 1fr); }
  .legend { gap: 10px; }
  footer { padding: 16px 20px; }
}
