:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-subtle: #f8fafc;
  --text: #172033;
  --muted: #667085;
  --line: #e4e9f0;
  --primary: #345d68;
  --primary-strong: #244650;
  --primary-soft: #e9f1f2;
  --accent: #c97851;
  --danger: #b54747;
  --danger-soft: #fff0f0;
  --success: #32705a;
  --shadow: 0 12px 32px rgba(23, 32, 51, 0.08);
  --shadow-sm: 0 4px 16px rgba(23, 32, 51, 0.06);
  --radius: 16px;
  --radius-sm: 10px;
  --content: 1080px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans JP", "Yu Gothic UI", "Yu Gothic", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

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

a {
  color: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid rgba(228, 233, 240, 0.92);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
}

.header-inner {
  width: min(calc(100% - 32px), var(--content));
  min-height: 68px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  font-family: Georgia, serif;
  font-size: 19px;
  font-weight: 700;
}

.brand-name {
  font-size: 17px;
  font-weight: 760;
  letter-spacing: 0.02em;
}

.brand > span:last-child {
  display: grid;
  line-height: 1.25;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

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

.nav-link {
  min-height: 40px;
  padding: 8px 13px;
  border-radius: 9px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  font-size: 14px;
  font-weight: 650;
  transition: background 160ms ease, color 160ms ease;
}

.nav-link:hover,
.nav-link:focus-visible {
  background: var(--surface-subtle);
  color: var(--text);
}

.nav-link[aria-current="page"] {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.page {
  width: min(calc(100% - 32px), var(--content));
  margin: 0 auto;
  padding: 42px 0 64px;
}

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.page-title {
  margin: 0;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.25;
  letter-spacing: -0.03em;
}

.page-description {
  max-width: 620px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.user-pill,
.status-pill,
.count-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}

.user-pill {
  padding: 8px 12px;
  text-decoration: none;
}

.user-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #a7b0bf;
}

.user-pill[data-signed-in="true"] .user-dot {
  background: #43a47b;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.panel-body {
  padding: 24px;
}

.panel-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-title,
.section-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.4;
}

.panel-caption {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.search-panel {
  margin-bottom: 26px;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.search-row > .button {
  align-self: end;
}

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

.field-grid.three {
  grid-template-columns: 1.2fr 1fr 0.65fr;
}

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

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

.field-label {
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

.field-help {
  margin: -1px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.input,
.textarea,
.select {
  width: 100%;
  min-height: 46px;
  padding: 10px 13px;
  border: 1px solid #cfd6e1;
  border-radius: var(--radius-sm);
  outline: none;
  background: var(--surface);
  color: var(--text);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

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

.input::placeholder,
.textarea::placeholder {
  color: #98a2b3;
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(52, 93, 104, 0.14);
}

.input:invalid:not(:placeholder-shown),
.textarea:invalid:not(:placeholder-shown) {
  border-color: #d67a7a;
}

.button-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.button {
  min-height: 44px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
  transition: transform 130ms ease, background 150ms ease, border-color 150ms ease;
}

.button:hover {
  background: var(--primary-strong);
}

.button:active {
  transform: translateY(1px);
}

.button:focus-visible,
.chip:focus-visible,
.icon-button:focus-visible {
  outline: 3px solid rgba(52, 93, 104, 0.22);
  outline-offset: 2px;
}

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.button.secondary {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}

.button.secondary:hover {
  border-color: #c5ceda;
  background: var(--surface-subtle);
}

.button.ghost {
  background: transparent;
  color: var(--primary-strong);
}

.button.ghost:hover {
  background: var(--primary-soft);
}

.button.danger {
  border-color: #f1caca;
  background: var(--danger-soft);
  color: var(--danger);
}

.button.danger:hover {
  background: #ffe3e3;
}

.button.small {
  min-height: 36px;
  padding: 6px 11px;
  border-radius: 8px;
  font-size: 13px;
}

.button.loading {
  pointer-events: none;
}

.button.loading::before,
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.chip-list {
  margin-top: 15px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  min-height: 34px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.chip:hover {
  border-color: #bdc7d5;
  color: var(--text);
}

.chip[aria-pressed="true"] {
  border-color: #b9cfd3;
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.room-filter-options {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.compact-field {
  width: min(100%, 230px);
}

.compact-field .select {
  min-height: 40px;
  padding-top: 7px;
  padding-bottom: 7px;
}

.compact-checkbox {
  padding-bottom: 1px;
}

.content-grid {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 92px;
}

.instance-list {
  display: grid;
  gap: 6px;
}

.instance-button {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
}

.instance-button:hover {
  background: var(--surface-subtle);
  color: var(--text);
}

.instance-button[aria-pressed="true"] {
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-weight: 700;
}

.instance-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.count-pill {
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

.section-heading {
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.section-meta {
  color: var(--muted);
  font-size: 13px;
}

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

.item-card {
  position: relative;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

button.item-card {
  width: 100%;
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.item-card:hover {
  border-color: #cdd6df;
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.item-card[role="button"] {
  cursor: pointer;
}

.item-card[role="button"]:focus-visible {
  border-color: var(--primary);
  outline: 3px solid rgba(52, 93, 104, 0.18);
  outline-offset: 2px;
}

.card-kicker {
  margin-bottom: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.room-metrics {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.heat-indicator {
  min-height: 27px;
  padding: 4px 7px;
  border: 1px solid #f0d2c2;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #fff8f4;
  color: #a94f2f;
  white-space: nowrap;
}

.heat-icon {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  fill: currentColor;
}

.heat-value {
  font-size: 10px;
  font-weight: 780;
  letter-spacing: 0.035em;
}

.heat-bars {
  height: 12px;
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
}

.heat-bar {
  width: 3px;
  height: 5px;
  border-radius: 1px;
  background: #ead9d1;
}

.heat-bar:nth-child(2) { height: 6px; }
.heat-bar:nth-child(3) { height: 8px; }
.heat-bar:nth-child(4) { height: 10px; }
.heat-bar:nth-child(5) { height: 12px; }
.heat-bar.active { background: currentColor; }

.card-title {
  margin: 0;
  font-size: 17px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.card-description {
  margin: 7px 0 0;
  color: var(--muted);
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.card-meta {
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
  list-style: none;
}

.tag-row {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 650;
}

.warning-row {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.warning-tag {
  padding: 3px 8px;
  border: 1px solid #f0caca;
  border-radius: 6px;
  background: var(--danger-soft);
  color: #8b3d3d;
  font-size: 11px;
  font-weight: 700;
}

.status-pill {
  padding: 4px 9px;
  background: var(--surface-subtle);
  font-size: 12px;
}

.status-pill.live {
  border-color: #a9d6c2;
  background: #e9f7f0;
  color: var(--success);
}

.status-pill.past {
  background: #f2f4f7;
  color: #7a8493;
}

.empty-state,
.loading-state,
.error-state {
  grid-column: 1 / -1;
  min-height: 220px;
  padding: 36px 20px;
  border: 1px dashed #ccd4df;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 9px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--muted);
  text-align: center;
}

.state-title {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 750;
}

.state-copy {
  max-width: 420px;
  margin: 0;
  font-size: 13px;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 22px;
  align-items: start;
}

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

.divider {
  height: 1px;
  margin: 22px 0;
  background: var(--line);
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: #344054;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
  margin: 3px 0 0;
  accent-color: var(--primary);
}

.room-management-layout {
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
}

.settings-group {
  margin: 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 13px;
}

.settings-group legend {
  padding: 0 6px;
  color: #344054;
  font-size: 13px;
  font-weight: 760;
}

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

.notice-box {
  padding: 12px 14px;
  border: 1px solid #eed9a8;
  border-radius: var(--radius-sm);
  display: grid;
  gap: 2px;
  background: #fffaf0;
  color: #72551a;
  font-size: 12px;
}

.copy-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.mono-input {
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
}

.room-settings-status {
  min-height: 58px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  color: var(--muted);
  font-size: 13px;
}

.auth-switch {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.notice-list,
.plan-list {
  display: grid;
  gap: 10px;
}

.notice-item,
.list-item {
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.notice-item.unread {
  border-left: 3px solid var(--accent);
  background: #fffaf7;
}

.list-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.list-item-title {
  margin: 0;
  font-size: 15px;
}

.list-item-meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.dialog {
  width: min(calc(100% - 32px), 540px);
  max-height: min(84vh, 760px);
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 80px rgba(17, 24, 39, 0.24);
  overflow: hidden;
}

.dialog::backdrop {
  background: rgba(20, 29, 42, 0.55);
  backdrop-filter: blur(3px);
}

.dialog-header {
  padding: 22px 24px 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.dialog-body {
  max-height: 55vh;
  padding: 0 24px 22px;
  overflow-y: auto;
}

.world-dialog {
  width: min(calc(100% - 32px), 680px);
}

.world-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 13px;
  display: block;
  object-fit: cover;
  background: var(--surface-subtle);
}

.world-description {
  margin: 16px 0 0;
  color: var(--muted);
  line-height: 1.75;
  white-space: pre-wrap;
}

.world-loading {
  min-height: 180px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.world-id {
  margin: 0;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
  overflow-wrap: anywhere;
}

.dialog-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 9px;
  background: var(--surface-subtle);
}

.icon-button {
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 20px;
}

.detail-grid {
  margin: 18px 0;
  padding: 14px;
  border-radius: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  background: var(--surface-subtle);
}

.detail-label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.detail-value {
  margin-top: 2px;
  display: block;
  font-weight: 700;
}

.participant-list {
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  list-style: none;
}

.participant {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-subtle);
  color: #475467;
  font-size: 12px;
}

.toast-region {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  width: min(calc(100% - 36px), 380px);
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #172033;
  color: #fff;
  box-shadow: var(--shadow);
  animation: toast-in 180ms ease-out;
  font-size: 13px;
}

.toast.error {
  background: #7f3030;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.site-footer {
  padding: 26px 16px 38px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

@media (max-width: 820px) {
  .content-grid,
  .split-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

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

  .field-grid.three {
    grid-template-columns: 1fr 1fr;
  }

  .field-grid.three .field:first-child {
    grid-column: 1 / -1;
  }

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

@media (max-width: 640px) {
  .header-inner {
    width: min(calc(100% - 20px), var(--content));
    min-height: 62px;
    gap: 10px;
  }

  .brand-subtitle,
  .nav-label {
    display: none;
  }

  .brand-name {
    font-size: 15px;
  }

  .site-nav {
    gap: 2px;
  }

  .nav-link {
    min-width: 42px;
    padding: 8px 10px;
    justify-content: center;
    font-size: 18px;
  }

  .page {
    width: min(calc(100% - 24px), var(--content));
    padding: 30px 0 48px;
  }

  .page-hero {
    align-items: flex-start;
    flex-direction: column;
    margin-bottom: 20px;
  }

  .page-title {
    font-size: 29px;
  }

  .panel-body,
  .panel-header {
    padding: 18px;
  }

  .search-row,
  .field-grid,
  .field-grid.three,
  .card-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .field-grid.three .field:first-child {
    grid-column: auto;
  }

  .instance-list {
    grid-template-columns: 1fr;
  }

  .button-row .button {
    flex: 1 1 auto;
  }

  .room-filter-options {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
  }

  .compact-field {
    width: 100%;
  }

  .warning-options,
  .copy-row {
    grid-template-columns: 1fr;
  }

  .card-kicker {
    align-items: flex-start;
  }

  .room-metrics {
    align-items: flex-end;
    flex-direction: column;
    gap: 4px;
  }

  .dialog-header,
  .dialog-body,
  .dialog-footer {
    padding-left: 18px;
    padding-right: 18px;
  }

  .dialog-footer .button {
    flex: 1 1 auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
