:root {
  --green-950: #073b32;
  --green-900: #075c49;
  --green-700: #0b7a5c;
  --green-500: #16a47a;
  --green-100: #daf4ea;
  --sand: #f7f3eb;
  --surface: #ffffff;
  --ink: #17211d;
  --muted: #63716b;
  --line: #dce7e1;
  --orange: #e56f35;
  --red: #c63f3f;
  --red-soft: #fff0f0;
  --yellow: #a66b00;
  --yellow-soft: #fff8df;
  --blue: #2762a8;
  --blue-soft: #edf5ff;
  --shadow: 0 18px 55px rgba(13, 65, 50, .12);
  --radius-lg: 28px;
  --radius-md: 18px;
  --sidebar: 260px;
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  background: var(--sand);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: #f5f8f6;
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", "Segoe UI", sans-serif;
  line-height: 1.6;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

.skip-link {
  position: fixed;
  top: -80px;
  left: 20px;
  z-index: 999;
  padding: 10px 16px;
  color: #fff;
  background: var(--green-950);
  border-radius: 10px;
}

.skip-link:focus {
  top: 20px;
}

.prototype-banner {
  padding: 8px 20px;
  color: #fff;
  background: var(--green-950);
  font-size: .82rem;
  font-weight: 800;
  text-align: center;
}

.portal-shell {
  min-height: calc(100vh - 40px);
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 26px 20px;
  color: #fff;
  background:
    radial-gradient(circle at 20% 5%, rgba(22, 164, 122, .28), transparent 30%),
    var(--green-950);
  overflow-y: auto;
}

.portal-brand {
  display: block;
  margin-bottom: 4px;
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-decoration: none;
}

.portal-subtitle {
  margin: 0 0 28px;
  color: #acd4c7;
  font-size: .82rem;
  font-weight: 700;
}

.portal-nav {
  display: grid;
  gap: 6px;
}

.portal-nav a {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 10px;
  padding: 10px 13px;
  color: #e8f4f0;
  border-radius: 12px;
  font-size: .92rem;
  font-weight: 750;
  text-decoration: none;
}

.portal-nav a:hover,
.portal-nav a[aria-current="page"] {
  color: #fff;
  background: rgba(255, 255, 255, .14);
}

.sidebar-note {
  margin-top: 28px;
  padding: 15px;
  color: #dcece7;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 14px;
  font-size: .8rem;
}

.portal-main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 32px;
  background: rgba(255, 255, 255, .95);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--green-950);
  background: #fff;
  cursor: pointer;
}

.topbar-title {
  margin-right: auto;
}

.topbar-title strong {
  display: block;
  color: var(--green-950);
}

.topbar-title span {
  color: var(--muted);
  font-size: .8rem;
}

.account-chip {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  padding: 0 14px;
  color: var(--green-900);
  background: var(--green-100);
  border-radius: 999px;
  font-size: .84rem;
  font-weight: 850;
}

.content {
  width: min(100% - 48px, 1240px);
  margin: 0 auto;
  padding: 38px 0 70px;
}

.page-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.eyebrow {
  display: inline-flex;
  padding: 6px 11px;
  color: var(--green-900);
  background: var(--green-100);
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .04em;
}

.page-head h1 {
  margin: 12px 0 4px;
  font-size: clamp(2rem, 4vw, 3.3rem);
  line-height: 1.12;
  letter-spacing: -.04em;
}

.page-head p {
  max-width: 700px;
  margin: 0;
  color: var(--muted);
}

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

.btn {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 850;
  text-decoration: none;
  cursor: pointer;
}

.btn-primary {
  color: #fff;
  background: var(--green-700);
}

.btn-secondary {
  color: var(--green-950);
  background: #fff;
  border-color: var(--line);
}

.btn-danger {
  color: var(--red);
  background: var(--red-soft);
  border-color: #f4caca;
}

.btn:disabled {
  opacity: .52;
  cursor: not-allowed;
}

.grid {
  display: grid;
  gap: 20px;
}

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

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

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

.panel,
.stat-card,
.result-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(13, 65, 50, .06);
}

.panel {
  padding: 24px;
}

.panel h2,
.panel h3 {
  margin-top: 0;
}

.stat-card {
  padding: 20px;
}

.stat-card span {
  color: var(--muted);
  font-size: .84rem;
  font-weight: 750;
}

.stat-card strong {
  display: block;
  margin-top: 7px;
  color: var(--green-950);
  font-size: 1.9rem;
}

.feature-link {
  min-height: 170px;
  display: flex;
  flex-direction: column;
  padding: 24px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  text-decoration: none;
  box-shadow: 0 10px 30px rgba(13, 65, 50, .06);
}

.feature-link:hover {
  border-color: var(--green-500);
  transform: translateY(-2px);
}

.feature-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  margin-bottom: 20px;
  background: var(--green-100);
  border-radius: 14px;
  font-size: 1.3rem;
}

.feature-link h2 {
  margin: 0 0 6px;
  font-size: 1.12rem;
}

.feature-link p {
  margin: 0;
  color: var(--muted);
  font-size: .9rem;
}

.feature-link strong {
  margin-top: auto;
  padding-top: 18px;
  color: var(--green-700);
  font-size: .86rem;
}

.notice {
  padding: 16px 18px;
  color: var(--yellow);
  background: var(--yellow-soft);
  border: 1px solid #f0dfa8;
  border-radius: 14px;
}

.notice-info {
  color: var(--blue);
  background: var(--blue-soft);
  border-color: #cfe0f5;
}

.search-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.field {
  display: grid;
  gap: 7px;
}

.field label,
.field-label {
  color: #34483f;
  font-size: .84rem;
  font-weight: 850;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #cfded7;
  border-radius: 12px;
  outline: none;
}

.textarea {
  min-height: 120px;
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--green-500);
  box-shadow: 0 0 0 4px rgba(22, 164, 122, .13);
}

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

.field-full {
  grid-column: 1 / -1;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0;
}

.filter-chip {
  min-height: 38px;
  padding: 0 14px;
  color: var(--green-900);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 800;
  cursor: pointer;
}

.filter-chip.is-active {
  color: #fff;
  background: var(--green-700);
  border-color: var(--green-700);
}

.result-list {
  display: grid;
  gap: 16px;
}

.result-card {
  padding: 22px;
}

.result-top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.result-top > div:first-child {
  flex: 1;
}

.result-card h2,
.result-card h3 {
  margin: 4px 0;
}

.result-card p {
  margin: 7px 0;
  color: var(--muted);
}

.meta-list {
  display: grid;
  gap: 5px;
  margin: 15px 0;
  color: #35483f;
  font-size: .9rem;
}

.badge {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 900;
}

.badge-open {
  color: var(--green-900);
  background: var(--green-100);
}

.badge-closed {
  color: var(--red);
  background: var(--red-soft);
}

.badge-check {
  color: var(--yellow);
  background: var(--yellow-soft);
}

.commission {
  margin-top: 15px;
  padding: 14px 16px;
  color: #fff;
  background: var(--green-950);
  border-radius: 12px;
  font-weight: 850;
}

.commission small {
  display: block;
  margin-bottom: 3px;
  color: #acd4c7;
}

.update-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: .82rem;
}

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

.compare-box {
  padding: 18px;
  background: #f8faf9;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.compare-box.is-new {
  background: #f0fbf6;
  border-color: #b9e4d3;
}

.room-card {
  padding: 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.room-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.qr-layout {
  display: grid;
  grid-template-columns: minmax(280px, 420px) 1fr;
  gap: 30px;
  align-items: start;
}

.qr-card {
  padding: 24px;
  text-align: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.qr-stage {
  min-height: 280px;
  display: grid;
  place-items: center;
  margin: 18px auto;
  padding: 18px;
  background: #fff;
  border: 1px dashed #b9ccc3;
  border-radius: 16px;
}

.qr-stage canvas,
.qr-stage img {
  width: min(100%, 260px);
  height: auto;
  margin: auto;
}

.room-code {
  font-size: 1.7rem;
  font-weight: 950;
  letter-spacing: .12em;
}

.listener-count {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 18px 0;
}

.listener-count strong {
  color: var(--green-700);
  font-size: 2.4rem;
}

.empty-state {
  padding: 44px 20px;
  color: var(--muted);
  text-align: center;
  background: #fff;
  border: 1px dashed #c7d7cf;
  border-radius: var(--radius-md);
}

.mobile-overlay {
  display: none;
}

.portal-footer {
  padding: 24px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: .8rem;
  text-align: center;
}

@media (max-width: 1050px) {
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .qr-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .portal-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 80;
    width: min(86vw, 300px);
    height: 100vh;
    transform: translateX(-105%);
    transition: transform .22s ease;
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  .mobile-overlay {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: none;
    background: rgba(4, 32, 26, .55);
  }

  body.nav-open .mobile-overlay {
    display: block;
  }

  .menu-toggle {
    display: grid;
    place-items: center;
  }

  .topbar {
    padding: 10px 18px;
  }

  .account-chip {
    display: none;
  }

  .content {
    width: min(100% - 30px, 1240px);
    padding-top: 28px;
  }

  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 620px) {
  .grid-2,
  .grid-3,
  .grid-4,
  .form-grid,
  .compare-grid {
    grid-template-columns: 1fr;
  }

  .field-full {
    grid-column: auto;
  }

  .search-box {
    grid-template-columns: 1fr;
  }

  .panel,
  .result-card {
    padding: 18px;
  }

  .page-head h1 {
    font-size: 2rem;
  }

  .btn {
    width: 100%;
  }

  .actions {
    width: 100%;
  }

  .update-line {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

/* Tourist listener landing page */
.listener-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 18px;
  background:
    radial-gradient(circle at 80% 10%, rgba(22, 164, 122, .2), transparent 32%),
    linear-gradient(145deg, #f3fbf7, #fff 58%, #f8f2e9);
}

.listener-shell {
  width: min(100%, 560px);
}

.listener-brand {
  margin-bottom: 18px;
  color: var(--green-950);
  font-size: 1.2rem;
  font-weight: 950;
  letter-spacing: .08em;
  text-align: center;
}

.listener-card {
  padding: clamp(24px, 6vw, 42px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 30px;
  box-shadow: var(--shadow);
  text-align: center;
}

.listener-card h1 {
  margin: 16px 0 8px;
  font-size: clamp(1.8rem, 7vw, 2.7rem);
  line-height: 1.18;
  letter-spacing: -.04em;
}

.listener-card p {
  color: var(--muted);
}

.listener-info {
  display: grid;
  gap: 10px;
  margin: 24px 0;
  padding: 18px;
  background: #f6faf8;
  border: 1px solid var(--line);
  border-radius: 16px;
  text-align: left;
}

.listener-info div {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 10px;
}

.listener-info dt {
  color: var(--muted);
  font-size: .84rem;
  font-weight: 800;
}

.listener-info dd {
  margin: 0;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.listener-code {
  color: var(--green-700);
  font-size: 1.25rem;
  letter-spacing: .1em;
}

.listen-button {
  width: 100%;
  min-height: 58px;
  margin-top: 8px;
  font-size: 1.05rem;
}

.listener-help {
  margin-top: 20px;
  padding: 15px;
  color: var(--yellow);
  background: var(--yellow-soft);
  border: 1px solid #f0dfa8;
  border-radius: 14px;
  font-size: .86rem;
  text-align: left;
}

.listener-footer {
  margin-top: 18px;
  color: var(--muted);
  font-size: .78rem;
  text-align: center;
}

@media (max-width: 420px) {
  .listener-info div {
    grid-template-columns: 1fr;
    gap: 1px;
  }
}

/* Shared language selector */
.language-switcher {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: #f2f7f4;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.language-switcher button {
  min-height: 34px;
  padding: 0 11px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 850;
  cursor: pointer;
}

.language-switcher button:hover {
  color: var(--green-900);
  background: #fff;
}

.language-switcher button[aria-pressed="true"] {
  color: #fff;
  background: var(--green-700);
}

.listener-language {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}

@media (max-width: 560px) {
  .language-switcher button {
    padding: 0 9px;
    font-size: .74rem;
  }
}
