:root {
  --blue: #3182f6;
  --blue-dark: #1b64da;
  --navy: #05214d;
  --cyan: #20c4d9;
  --ink: #191f28;
  --muted: #6b7684;
  --subtle: #8b95a1;
  --line: #e5e8eb;
  --canvas: #f5f6f8;
  --paper: #ffffff;
  --danger: #f04452;
  --success: #00a878;
  --warning: #f59f00;
  font-family: "IBM Plex Sans KR", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--canvas); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--canvas); -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
}
button:focus { outline: none; }
button:focus-visible { box-shadow: inset 0 0 0 2px rgba(49,130,246,.55); }
.hidden { display: none !important; }

.site-header {
  position: sticky; top: 0; z-index: 10;
  height: 72px; padding: 0 max(24px, calc((100vw - 1120px) / 2));
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(255,255,255,.9); border-bottom: 1px solid rgba(0,0,0,.05);
  backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 13px; color: inherit; text-decoration: none; }
.brand img { width: 112px; height: auto; display: block; }
.brand-divider { width: 1px; height: 18px; background: #d1d6db; }
.service-name { font-size: 15px; font-weight: 700; color: #333d4b; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.connection-state { padding: 8px 12px; border-radius: 999px; color: var(--muted); background: #f2f4f6; font-size: 12px; font-weight: 600; }
.connection-state i { display: inline-block; width: 7px; height: 7px; margin-right: 6px; background: var(--warning); border-radius: 50%; }
.connection-state.online i { background: var(--success); }
.icon-button {
  width: 40px; height: 40px; border: 0; border-radius: 14px;
  color: #4e5968; background: #f2f4f6; font-size: 22px;
  transition: transform .15s, background .15s;
}
.icon-button:hover { background: #e5e8eb; transform: rotate(12deg); }

main { width: min(1120px, calc(100% - 40px)); margin: 0 auto; padding: 56px 0 96px; }
.hero {
  position: relative; overflow: hidden;
  min-height: 300px; margin-bottom: 24px; padding: 52px 56px;
  display: flex; justify-content: space-between; align-items: flex-end; gap: 32px;
  background: linear-gradient(135deg, #eaf3ff 0%, #f1fbfd 100%);
  border-radius: 32px;
}
.hero::after {
  content: ""; position: absolute; right: -60px; top: -100px;
  width: 360px; height: 360px; border-radius: 50%;
  background: rgba(49,130,246,.08);
}
.hero > * { position: relative; z-index: 1; }
.eyebrow { margin: 0 0 13px; color: var(--blue); font-size: 12px; font-weight: 800; letter-spacing: .11em; }
h1 { margin: 0; color: var(--ink); font-size: clamp(38px, 5.5vw, 60px); line-height: 1.18; letter-spacing: -.045em; }
.hero-copy { max-width: 520px; margin: 20px 0 0; color: var(--muted); font-size: 17px; line-height: 1.7; }
.date-control { min-width: 190px; padding: 18px; background: rgba(255,255,255,.82); border-radius: 20px; box-shadow: 0 8px 30px rgba(49,130,246,.08); }
.date-control label { display: block; margin-bottom: 9px; color: var(--muted); font-size: 12px; font-weight: 700; }
.date-stepper { display: grid; grid-template-columns: 34px 1fr 34px; align-items: center; gap: 5px; }
.date-stepper input { width: 100%; min-width: 0; padding: 5px 2px; border: 0; outline: 0; background: transparent; color: var(--ink); font-weight: 700; text-align: center; }
.date-stepper button { width: 34px; height: 34px; padding: 0; border: 0; border-radius: 11px; color: #4e5968; background: #f2f4f6; font-size: 25px; line-height: 1; transition: .15s; }
.date-stepper button:hover { color: var(--blue); background: #e8f1ff; }
.date-stepper button:disabled { cursor: not-allowed; color: #b0b8c1; background: #f2f4f6; opacity: .48; }

.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 34px; background: transparent; }
.summary div {
  min-height: 112px; padding: 24px 26px; border: 0; border-radius: 24px;
  display: flex; align-items: center; justify-content: space-between;
  color: var(--ink); background: white; box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.summary span { color: var(--muted); font-size: 14px; font-weight: 600; }
.summary strong { font-size: 30px; font-weight: 700; letter-spacing: -.04em; }
.summary div:nth-child(1) strong { color: var(--warning); }
.summary div:nth-child(2) strong { color: var(--cyan); }
.summary div:nth-child(3) strong { color: var(--blue); }
.summary .current-time-display { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.summary .current-time-display small { color: var(--subtle); font-size: 10px; font-weight: 500; white-space: nowrap; }

.toolbar { margin: 0 0 20px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.hour-tabs {
  flex: 1; display: flex; gap: 8px; min-width: 0; overflow-x: auto;
  padding: 3px 1px 5px;
  scrollbar-width: none;
}
.hour-tabs::-webkit-scrollbar { display: none; }
.hour-tab {
  min-width: 66px; padding: 11px 15px; border: 0; border-radius: 14px;
  background: #e9ecef; color: var(--muted); font-size: 13px; font-weight: 700;
  transition: .16s;
}
.hour-tab:hover { background: #dde2e6; }
.hour-tab.active { position: relative; z-index: 1; background: var(--ink); color: white; box-shadow: none; }
.hour-tab.active:focus-visible { box-shadow: inset 0 0 0 2px rgba(255,255,255,.62); }
.hour-tab:disabled { cursor: not-allowed; color: #b0b8c1; background: #eef0f2; opacity: .52; }
.legend { display: flex; gap: 15px; color: var(--subtle); font-size: 11px; white-space: nowrap; }
.dot { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; }
.dot.reserved { background: var(--warning); }
.dot.confirmed { background: var(--cyan); }
.dot.available { background: var(--success); }

.toolbar-meta { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; }
.room-options { position: relative; z-index: 8; display: flex; justify-content: flex-end; margin: 0; }
.room-options-button {
  min-height: 46px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 15px;
  display: grid; grid-template-columns: auto auto auto; align-items: center; gap: 8px 14px;
  color: #333d4b; background: white; box-shadow: 0 1px 3px rgba(0,0,0,.04);
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.room-options-button:hover, .room-options.open .room-options-button { border-color: #c7d8ee; background: #f8fbff; }
.room-options-button.active { border-color: #9ac2fb; background: #edf4ff; }
.room-options-label { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 800; }
.room-options-button small { color: var(--muted); font-size: 11px; font-weight: 600; }
.room-options-label .options-icon { width: 17px; height: 17px; color: var(--blue); }
.room-options-chevron { width: 16px; height: 16px; color: var(--subtle); transition: transform .18s; }
.room-options.open .room-options-chevron { transform: rotate(180deg); }
.room-options-panel {
  position: absolute; top: calc(100% + 9px); right: 0; z-index: 12;
  width: min(360px, calc(100vw - 40px)); padding: 18px;
  border: 1px solid rgba(0,0,0,.06); border-radius: 22px; background: white;
  box-shadow: 0 20px 55px rgba(15,33,55,.18); animation: options-in .16s ease-out;
}
.room-options-panel[hidden] { display: none; }
.room-options-panel fieldset { margin: 0; padding: 0; border: 0; }
.room-options-panel fieldset + fieldset { margin-top: 18px; padding-top: 17px; border-top: 1px solid #eef0f2; }
.room-options-panel legend { margin-bottom: 11px; color: var(--ink); font-size: 14px; font-weight: 800; }
.room-options-panel p { margin: -3px 0 12px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.option-segments { display: grid; gap: 8px; }
.sort-options { grid-template-columns: repeat(2, 1fr); }
.filter-options { grid-template-columns: repeat(2, 1fr); }
.option-segments label { position: relative; min-width: 0; }
.option-segments input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.option-segments span {
  min-height: 42px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 13px;
  display: flex; align-items: center; justify-content: center; gap: 7px; color: #4e5968; background: white;
  font-size: 12px; font-weight: 700; cursor: pointer; transition: .15s;
}
.ui-icon {
  width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor;
  stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round;
}
.room-options-button.active .options-icon { color: var(--blue-dark); }
.option-segments label:hover span { border-color: #b9d3f6; background: #f8fbff; }
.option-segments input:checked + span { border-color: var(--blue); color: white; background: var(--blue); box-shadow: 0 4px 12px rgba(49,130,246,.20); }
.option-segments input:focus-visible + span { box-shadow: 0 0 0 3px rgba(49,130,246,.18); }
@keyframes options-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

.room-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.room-card {
  position: relative; min-height: 210px; padding: 27px; overflow: hidden;
  background: var(--paper); border: 0; border-radius: 26px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
  transition: transform .2s ease, box-shadow .2s ease;
}
.room-card.actionable:hover { transform: translateY(-3px); box-shadow: 0 14px 38px rgba(32,38,46,.10); }
.room-card::after {
  content: ""; position: absolute; right: -28px; bottom: -48px;
  width: 132px; height: 132px; border-radius: 50%; background: #f2f4f6;
}
.room-card.reserved_pending::after, .room-card.mine::after { background: #fff6df; }
.room-card.checked_in::after { background: #e8fbfd; }
.room-card.available::after { background: #eaf9f4; }
.room-card.closed { background: #f2f4f6; box-shadow: none; }
.room-card.closed::after { background: #dfe3e8; }
.card-head { position: relative; z-index: 1; display: flex; justify-content: space-between; gap: 16px; }
.room-number { margin: 0; color: var(--ink); font-size: 27px; font-weight: 800; letter-spacing: -.04em; }
.status-chip { align-self: start; padding: 7px 11px; border-radius: 999px; background: #f2f4f6; color: var(--muted); font-size: 11px; font-weight: 700; }
.reserved_pending .status-chip, .mine .status-chip { color: #b66a00; background: #fff3d4; }
.checked_in .status-chip { color: #0089a0; background: #e4f9fc; }
.available .status-chip { color: #008661; background: #e4f8f1; }
.closed .status-chip { color: #6b7684; background: #e1e5e9; }
.room-detail { position: relative; z-index: 1; min-height: 48px; margin: 24px 0 19px; color: var(--muted); font-size: 14px; line-height: 1.65; }
.card-footer { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: center; color: var(--subtle); font-size: 12px; }
.card-button { padding: 9px 13px; border: 0; border-radius: 12px; color: white; background: var(--blue); font-weight: 800; box-shadow: 0 4px 12px rgba(49,130,246,.22); transition: .15s; }
.card-button:hover { background: var(--blue-dark); transform: translateY(-1px); }
.room-card.reserved_pending .card-button,
.room-card.mine .card-button { color: white; background: #c56800; box-shadow: 0 4px 12px rgba(197,104,0,.22); }
.room-card.reserved_pending .card-button:hover,
.room-card.mine .card-button:hover { background: #a95500; }
.room-card.checked_in .card-button { color: white; background: #007f95; box-shadow: 0 4px 12px rgba(0,127,149,.22); }
.room-card.checked_in .card-button:hover { background: #006b7d; }
.room-card.available .card-button { color: white; background: #00805d; box-shadow: 0 4px 12px rgba(0,128,93,.22); }
.room-card.available .card-button:hover { background: #006c4e; }
.room-card.closed .card-button:disabled { cursor: not-allowed; color: white; background: #4e5968; box-shadow: 0 4px 10px rgba(78,89,104,.18); transform: none; }

.empty-state { padding: 90px 20px; text-align: center; color: var(--muted); background: white; border: 0; border-radius: 28px; }
.empty-state span { font-size: 40px; color: var(--line); }
.empty-state h2 { color: var(--ink); }
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 20;
  max-width: min(440px, calc(100vw - 40px)); padding: 14px 20px;
  color: white; background: #333d4b; border-radius: 14px;
  box-shadow: 0 12px 35px rgba(0,0,0,.2);
  opacity: 0; transform: translate(-50%, 16px); pointer-events: none; transition: .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }

.dialog {
  width: min(480px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 28px;
  color: var(--ink); box-shadow: 0 24px 80px rgba(0, 27, 55, .24);
}
.dialog::backdrop { background: rgba(25,31,40,.48); backdrop-filter: blur(5px); }
.dialog form { position: relative; padding: 36px; }
.dialog h2 { margin: 0; color: var(--ink); font-size: 28px; letter-spacing: -.035em; }
.dialog-description { margin: 17px 0 28px; color: var(--muted); line-height: 1.7; }
.dialog-close { position: absolute; top: 18px; right: 20px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: #f2f4f6; color: #6b7684; font-size: 23px; }
.dialog-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.button { padding: 13px 18px; border: 0; border-radius: 14px; color: var(--blue); background: #edf4ff; font-weight: 800; }
.button.primary { color: white; background: var(--blue); }
.button.primary:hover { background: var(--blue-dark); }
.button.danger { color: white; background: var(--danger); }
.button:disabled, .button:disabled:hover {
  cursor: not-allowed; color: #8b95a1; background: #e5e8eb; box-shadow: none; opacity: .78;
}
.button.full { width: 100%; }
.reservation-dialog { width: min(560px, calc(100% - 32px)); }
.reservation-dialog form { max-height: min(780px, calc(100vh - 40px)); overflow-y: auto; }
.room-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 24px 0 28px; }
.room-facts div { padding: 17px 18px; border-radius: 18px; background: #f5f7fa; }
.room-facts span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 12px; font-weight: 700; }
.room-facts strong { color: var(--ink); font-size: 20px; }
.reservation-section { margin: 0 0 26px; padding: 0; border: 0; }
.reservation-section legend { margin-bottom: 12px; color: var(--ink); font-size: 15px; font-weight: 800; }
.field-help { margin: -5px 0 14px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.duration-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.duration-buttons button { padding: 13px 8px; border: 1px solid var(--line); border-radius: 14px; color: #4e5968; background: white; font-weight: 800; transition: .15s; }
.duration-buttons button:hover { border-color: #9ac2fb; background: #f5f9ff; }
.duration-buttons button.selected { border-color: var(--blue); color: white; background: var(--blue); box-shadow: 0 5px 16px rgba(49,130,246,.22); }
.student-id-inputs { display: grid; gap: 10px; }
.student-id-field { display: grid; grid-template-columns: 108px 1fr; align-items: center; gap: 12px; }
.student-id-field span { color: #4e5968; font-size: 13px; font-weight: 700; }
.student-id-field input { width: 100%; padding: 13px 14px; border: 1px solid var(--line); border-radius: 13px; outline: 0; color: var(--ink); background: white; font-weight: 700; transition: border-color .15s, box-shadow .15s; }
.student-id-field input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(49,130,246,.12); }
.student-id-field input::placeholder { color: #b0b8c1; font-weight: 500; }
.participant-summary { display: flex; justify-content: space-between; gap: 12px; margin-top: 12px; color: var(--muted); font-size: 12px; }
.participant-summary span:first-child { color: var(--blue-dark); font-weight: 800; }
.form-error { margin: -8px 0 15px; padding: 12px 14px; border-radius: 12px; color: #c72c3b; background: #fff0f1; font-size: 13px; font-weight: 700; }
.reserve-submit { padding: 15px 18px; color: white; background: #00805d; box-shadow: 0 6px 18px rgba(0,128,93,.22); }
.reserve-submit:hover { background: #006c4e; }
.reserve-submit:disabled { cursor: not-allowed; color: #8b95a1; background: #e5e8eb; box-shadow: none; }
.reserve-submit:disabled:hover { background: #e5e8eb; }
.progress-dialog { text-align: center; }
.progress-content { padding: 38px 34px 30px; }
.progress-content h2 { margin: 20px 0 0; color: var(--ink); font-size: 26px; }
.progress-spinner { width: 54px; height: 54px; margin: 0 auto; border: 5px solid #e8f1ff; border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }
.progress-spinner.success,
.progress-spinner.error { display: grid; place-items: center; border: 0; animation: none; color: white; font-size: 28px; font-weight: 800; }
.progress-spinner.success { background: var(--success); }
.progress-spinner.error { background: var(--danger); }
.progress-spinner.success::before { content: "✓"; }
.progress-spinner.error::before { content: "!"; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-card {
  min-height: 210px; border-radius: 26px;
  background: linear-gradient(90deg, #fff 20%, #eef1f4 50%, #fff 80%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

@media (max-width: 760px) {
  .site-header { height: 64px; padding: 0 18px; }
  .brand img { width: 94px; }
  .connection-state { display: none; }
  main { width: min(100% - 28px, 1120px); padding: 26px 0 72px; }
  .hero { min-height: 360px; padding: 34px 26px; align-items: stretch; flex-direction: column; border-radius: 26px; }
  .hero-copy { font-size: 15px; }
  .date-control { width: 100%; margin-top: auto; }
  .summary { grid-template-columns: 1fr 1fr; gap: 10px; }
  .summary div { min-height: 92px; padding: 19px; border-radius: 20px; }
  .summary div:last-child { grid-column: 1 / -1; }
  .summary strong { font-size: 26px; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .toolbar-meta { order: -1; width: 100%; justify-content: space-between; gap: 8px; }
  .legend { gap: 10px; padding-left: 4px; }
  .room-options-button {
    width: 44px; height: 40px; min-height: 40px; padding: 0; border-radius: 13px;
    display: grid; grid-template-columns: 1fr; place-items: center;
  }
  .room-options-label { gap: 0; font-size: 0; }
  .room-options-label .options-icon { width: 18px; height: 18px; }
  .room-options-button small, .room-options-chevron { display: none; }
  .room-options-panel { left: auto; right: 0; width: min(292px, calc(100vw - 28px)); padding: 15px; border-radius: 18px; }
  .room-options-panel fieldset + fieldset { margin-top: 15px; padding-top: 14px; }
  .room-options-panel legend { margin-bottom: 8px; font-size: 13px; }
  .room-options-panel p { display: none; }
  .option-segments { gap: 6px; }
  .option-segments span { min-height: 36px; padding: 7px 6px; gap: 5px; font-size: 11px; }
  .option-segments .ui-icon { width: 15px; height: 15px; }
  .room-grid { grid-template-columns: 1fr; }
  .room-card { min-height: 194px; padding: 23px; border-radius: 23px; }
  .dialog form { padding: 32px 24px 24px; }
  .dialog-actions { flex-direction: column; }
  .button { width: 100%; }
  .student-id-field { grid-template-columns: 1fr; gap: 6px; }
}
