:root {
  --ink: #111a2d;
  --muted: #6f7890;
  --paper: #f5f7fb;
  --card: #ffffff;
  --line: #e3e7f0;
  --navy: #101827;
  --navy-soft: #182238;
  --coral: #ff7d68;
  --coral-soft: #fff0ed;
  --blue: #4c79e8;
  --blue-soft: #edf2ff;
  --mint: #5bbca3;
  --mint-soft: #eaf8f4;
  --gold: #e4ad5e;
  --shadow: 0 18px 48px rgba(17, 26, 45, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; min-height: 100vh; background: var(--paper); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid rgba(76, 121, 232, 0.35); outline-offset: 2px; }
a { color: inherit; }

.lab-header { position: sticky; top: 0; z-index: 20; border-bottom: 1px solid rgba(227, 231, 240, 0.9); background: rgba(245, 247, 251, 0.9); backdrop-filter: blur(18px); }
.lab-header-inner { display: flex; align-items: center; justify-content: space-between; width: min(1680px, calc(100% - 40px)); min-height: 78px; margin: 0 auto; }
.lab-brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; }
.lab-brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 13px; color: #fff; background: linear-gradient(135deg, var(--coral), #ffad73); font-size: 12px; font-weight: 800; letter-spacing: -0.04em; box-shadow: 0 8px 18px rgba(255, 125, 104, 0.24); }
.lab-brand strong, .lab-brand small { display: block; line-height: 1; }
.lab-brand strong { font-size: 15px; letter-spacing: -0.03em; }
.lab-brand small { margin-top: 5px; color: var(--muted); font-size: 10px; letter-spacing: 0.12em; }
.lab-header-meta { display: flex; align-items: center; gap: 18px; }
.lab-mode-badge { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid #d9e1f1; border-radius: 999px; color: #53658a; background: #fff; font-size: 10px; font-weight: 800; letter-spacing: 0.12em; }
.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 4px rgba(91, 188, 163, 0.14); }
.lab-language-switcher { display: inline-flex; gap: 3px; padding: 3px; border-radius: 999px; background: #e9edf5; }
.lab-language-switcher button { min-width: 38px; padding: 6px 8px; border: 0; border-radius: 999px; color: var(--muted); background: transparent; font-size: 11px; font-weight: 700; }
.lab-language-switcher button.is-active { color: var(--ink); background: #fff; box-shadow: 0 2px 8px rgba(17, 26, 45, 0.08); }

.lab-shell { display: grid; grid-template-columns: 218px minmax(0, 1fr) 300px; width: min(1680px, calc(100% - 40px)); min-height: calc(100vh - 78px); margin: 0 auto; }
.lab-sidebar { padding: 34px 18px 28px 0; border-right: 1px solid var(--line); }
.sidebar-intro { padding: 0 14px 20px; }
.eyebrow { color: #8490aa; font-size: 10px; font-weight: 800; letter-spacing: 0.16em; }
.sidebar-intro p { margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.lab-nav { display: grid; gap: 3px; }
.lab-nav button { display: flex; align-items: center; gap: 11px; width: 100%; padding: 11px 14px; border: 0; border-radius: 12px; color: #778198; background: transparent; text-align: left; font-size: 13px; }
.lab-nav button:hover { color: var(--ink); background: #eaf0fb; }
.lab-nav button.is-active { color: #fff; background: var(--navy); box-shadow: 0 10px 22px rgba(16, 24, 39, 0.14); }
.nav-icon { display: inline-grid; place-items: center; width: 20px; color: currentColor; font-size: 15px; }
.sidebar-footnote { margin: 28px 14px 0; padding: 15px; border-radius: 16px; color: #56647e; background: #e9f7f3; }
.sidebar-footnote strong { font-size: 12px; }
.sidebar-footnote p { margin: 7px 0 0; font-size: 11px; line-height: 1.6; }

.lab-main { min-width: 0; padding: 34px clamp(20px, 4vw, 54px) 70px; }
.lab-main-topline { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; min-height: 44px; }
.active-user-line { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.operation-status { max-width: 360px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: #fff; font-size: 11px; text-align: right; }
.operation-status[data-state="success"] { color: #24745d; border-color: #c6e9de; background: var(--mint-soft); }
.operation-status[data-state="error"] { color: #a7473e; border-color: #ffd3cc; background: var(--coral-soft); }
.operation-status[data-state="busy"] { color: #4967a7; border-color: #d4def7; background: var(--blue-soft); }
.lab-content { margin-top: 25px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 23px; }
.page-heading h1 { margin: 6px 0 0; font-size: clamp(26px, 3vw, 40px); letter-spacing: -0.06em; line-height: 1.1; }
.page-heading p { max-width: 440px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.page-heading-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

.notice { display: flex; align-items: flex-start; gap: 13px; margin-bottom: 20px; padding: 15px 17px; border: 1px solid #d8e1f7; border-radius: 16px; color: #53658a; background: #f1f5ff; font-size: 12px; line-height: 1.65; }
.notice strong { display: block; margin-bottom: 2px; color: #334b84; }
.notice p { margin: 0; }
.notice-icon { flex: 0 0 auto; display: grid; place-items: center; width: 27px; height: 27px; border-radius: 9px; color: var(--blue); background: #fff; font-weight: 800; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.metric-card { padding: 17px; border: 1px solid var(--line); border-radius: 17px; background: var(--card); box-shadow: 0 8px 22px rgba(17, 26, 45, 0.03); }
.metric-card .metric-label { color: var(--muted); font-size: 11px; }
.metric-card strong { display: block; margin-top: 8px; font-size: 28px; letter-spacing: -0.06em; }
.metric-card small { display: block; margin-top: 4px; color: #9ca5b8; font-size: 10px; }
.metric-card:nth-child(2) strong { color: var(--coral); }
.metric-card:nth-child(3) strong { color: var(--blue); }
.metric-card:nth-child(4) strong { color: var(--mint); }

.panel-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr); gap: 16px; }
.panel { min-width: 0; padding: 21px; border: 1px solid var(--line); border-radius: 19px; background: var(--card); box-shadow: 0 8px 22px rgba(17, 26, 45, 0.03); }
.panel + .panel { margin-top: 16px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 17px; }
.panel-heading h2 { margin: 0; font-size: 17px; letter-spacing: -0.04em; }
.panel-heading p { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.subtle-link { border: 0; color: var(--blue); background: transparent; font-size: 11px; font-weight: 700; white-space: nowrap; }
.quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.quick-card { display: block; padding: 14px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: #fbfcff; text-align: left; }
.quick-card:hover { border-color: #bdcbee; background: var(--blue-soft); }
.quick-card strong { display: block; font-size: 13px; }
.quick-card span { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.activity-list, .conversation-list, .community-list { display: grid; gap: 10px; }
.activity-row, .conversation-row, .community-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid #eef0f5; }
.activity-row:last-child, .conversation-row:last-child, .community-row:last-child { border-bottom: 0; }
.activity-symbol, .community-symbol { display: grid; place-items: center; flex: 0 0 auto; width: 36px; height: 36px; border-radius: 12px; color: var(--blue); background: var(--blue-soft); font-size: 17px; }
.activity-row main, .conversation-row main, .community-row main { min-width: 0; flex: 1; }
.activity-row strong, .conversation-row strong, .community-row strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.activity-row small, .conversation-row small, .community-row small { display: block; margin-top: 4px; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.empty-state { padding: 35px 15px; color: var(--muted); text-align: center; }
.empty-state strong { display: block; margin-bottom: 6px; color: var(--ink); font-size: 14px; }
.empty-state p { margin: 0; font-size: 12px; line-height: 1.6; }

.filter-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-bottom: 15px; }
.filter-bar .text-input { flex: 1 1 180px; }
.select-input, .text-input, .textarea-input { width: 100%; border: 1px solid #d9dfeb; border-radius: 10px; color: var(--ink); background: #fff; }
.select-input, .text-input { min-height: 40px; padding: 0 12px; font-size: 12px; }
.textarea-input { min-height: 100px; padding: 11px 12px; resize: vertical; font-size: 12px; line-height: 1.6; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 0 14px; border: 1px solid transparent; border-radius: 10px; font-size: 12px; font-weight: 750; text-decoration: none; }
.button-primary { color: #fff; background: var(--navy); }
.button-primary:hover { background: #253452; }
.button-secondary { color: #3e5da1; border-color: #ccd8f5; background: var(--blue-soft); }
.button-soft { color: #4c5a73; border-color: var(--line); background: #fff; }
.button-danger { color: #ad4e45; border-color: #ffd6d0; background: var(--coral-soft); }
.button-small { min-height: 32px; padding: 0 10px; font-size: 10px; }
.button:disabled { cursor: not-allowed; opacity: 0.5; }

.user-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.user-card { display: flex; min-width: 0; flex-direction: column; padding: 17px; border: 1px solid var(--line); border-radius: 17px; background: var(--card); box-shadow: 0 8px 20px rgba(17, 26, 45, 0.025); }
.user-card:hover { border-color: #bac7e8; box-shadow: var(--shadow); transform: translateY(-1px); transition: 160ms ease; }
.user-card-top { display: flex; align-items: flex-start; gap: 11px; }
.avatar { display: grid; place-items: center; flex: 0 0 auto; width: 48px; height: 48px; overflow: hidden; border-radius: 16px; background: linear-gradient(135deg, #f6b5a7, #f3d6a0); box-shadow: inset 0 0 0 1px rgba(255,255,255,.6); }
.avatar img { display: block; width: 100%; height: 100%; }
.user-card-top main { min-width: 0; flex: 1; }
.user-card h3 { margin: 2px 0 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; letter-spacing: -0.03em; }
.user-meta { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.demo-tag, .score-tag, .status-tag, .privacy-tag { display: inline-flex; align-items: center; width: fit-content; padding: 4px 7px; border-radius: 999px; color: #60709a; background: #eef2fb; font-size: 9px; font-weight: 800; letter-spacing: .03em; }
.score-tag { color: #24745d; background: var(--mint-soft); }
.status-tag { color: #a16c28; background: #fff7e9; }
.privacy-tag { color: #7d6d95; background: #f5effb; }
.user-bio { display: -webkit-box; min-height: 39px; margin: 13px 0 11px; overflow: hidden; color: #536078; font-size: 11px; line-height: 1.6; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.interest-row { display: flex; flex-wrap: wrap; gap: 5px; min-height: 22px; }
.interest-chip { padding: 4px 7px; border-radius: 7px; color: #65718a; background: #f1f3f7; font-size: 9px; }
.user-card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 14px; }
.recommendation-reason { margin: 11px 0 0; padding: 9px 10px; border-radius: 10px; color: #65718a; background: #fafbfe; font-size: 10px; line-height: 1.55; }
.recommendation-reason strong { color: #3e5da1; }
.filtered-summary { margin: 0 0 13px; color: var(--muted); font-size: 11px; }

.event-grid, .community-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.event-card, .community-card { padding: 17px; border: 1px solid var(--line); border-radius: 17px; background: var(--card); }
.event-topline, .community-topline { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.event-category { color: var(--blue); font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.event-card h3, .community-card h3 { margin: 10px 0 7px; font-size: 16px; letter-spacing: -0.04em; }
.event-card p, .community-card p { min-height: 38px; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.event-details { display: grid; gap: 6px; margin: 14px 0; color: #68748c; font-size: 10px; }
.event-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.event-actions small { color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.form-field { display: grid; gap: 6px; }
.form-field.full { grid-column: 1 / -1; }
.form-field label, .field-label { color: #69758c; font-size: 10px; font-weight: 750; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }

.profile-layout { display: grid; grid-template-columns: minmax(0, .7fr) minmax(0, 1.3fr); gap: 16px; }
.profile-hero { padding: 24px; border-radius: 20px; color: #fff; background: linear-gradient(145deg, var(--navy), #253a61); }
.profile-hero .avatar { width: 72px; height: 72px; margin-bottom: 17px; border: 3px solid rgba(255,255,255,.2); }
.profile-hero h2 { margin: 0; font-size: 25px; letter-spacing: -0.06em; }
.profile-hero p { margin: 8px 0 0; color: #b4c1dc; font-size: 12px; line-height: 1.6; }
.profile-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-top: 22px; }
.profile-stats div { padding-top: 11px; border-top: 1px solid rgba(255,255,255,.14); }
.profile-stats strong, .profile-stats small { display: block; }
.profile-stats strong { font-size: 17px; }
.profile-stats small { margin-top: 4px; color: #a7b5d1; font-size: 9px; }

.weight-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px 17px; }
.weight-field { display: grid; gap: 6px; }
.weight-field label { display: flex; justify-content: space-between; color: #69758c; font-size: 10px; }
.weight-field output { color: var(--blue); font-weight: 800; }
input[type="range"] { width: 100%; accent-color: var(--blue); }
.algorithm-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.algorithm-table th, .algorithm-table td { padding: 10px 8px; border-bottom: 1px solid #eef0f5; text-align: left; vertical-align: top; }
.algorithm-table th { color: var(--muted); font-size: 10px; font-weight: 700; }
.algorithm-table td strong { display: block; margin-bottom: 4px; }
.algorithm-table td span { color: var(--muted); line-height: 1.5; }

.developer-console { padding: 34px 0 28px 20px; border-left: 1px solid var(--line); }
.console-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.console-heading h2 { margin: 6px 0 0; font-size: 16px; letter-spacing: -0.04em; }
.console-lock { padding: 5px 7px; border-radius: 6px; color: #6e7d98; background: #e8edf6; font-size: 8px; font-weight: 800; letter-spacing: .1em; }
.console-description { margin: 11px 0 18px; color: var(--muted); font-size: 11px; line-height: 1.65; }
.user-switcher { display: grid; gap: 5px; max-height: 238px; margin-top: 8px; overflow: auto; }
.switch-user { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px; border: 1px solid transparent; border-radius: 10px; color: var(--ink); background: transparent; text-align: left; }
.switch-user:hover { background: #eaf0fb; }
.switch-user.is-active { border-color: #c9d6f5; background: var(--blue-soft); }
.switch-user .avatar { width: 30px; height: 30px; border-radius: 10px; }
.switch-user main { min-width: 0; flex: 1; }
.switch-user strong, .switch-user small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switch-user strong { font-size: 11px; }
.switch-user small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.console-divider { height: 1px; margin: 20px 0; background: var(--line); }
.console-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 10px; }
.console-row strong { color: var(--ink); font-size: 15px; }
.inline-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 7px; }
.console-button { width: 100%; margin-top: 8px; min-height: 36px; border: 0; border-radius: 9px; color: #fff; background: var(--navy); font-size: 11px; font-weight: 800; }
.console-button:hover { background: #253452; }
.console-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px; margin-top: 8px; }
.text-button { padding: 3px 0; border: 0; color: var(--blue); background: transparent; font-size: 10px; }
.text-button.danger { color: #b35d54; }
.console-log-wrap { margin-top: 22px; }
.console-log { display: grid; gap: 9px; max-height: 170px; margin: 12px 0 0; padding: 0 0 0 16px; overflow: auto; color: #71809b; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 9px; line-height: 1.5; }
.console-log li::marker { color: var(--mint); }
.console-log time { display: block; color: #a3adbf; }
.console-log .log-error { color: #b1534a; }
.console-log .log-success { color: #24745d; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 50; max-width: min(360px, calc(100% - 48px)); padding: 12px 15px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: #fff; box-shadow: var(--shadow); font-size: 12px; opacity: 0; pointer-events: none; transform: translateY(8px); transition: 180ms ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.noscript { margin: 20px; padding: 20px; color: #a7473e; background: var(--coral-soft); }

@media (max-width: 1220px) {
  .lab-shell { grid-template-columns: 195px minmax(0, 1fr); }
  .developer-console { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(210px, .7fr) minmax(240px, 1fr) minmax(240px, .8fr); gap: 18px; padding: 18px 0 30px; border-top: 1px solid var(--line); border-left: 0; }
  .console-heading, .console-description { grid-column: 1; }
  .developer-console > .field-label, .developer-console > #user-search, .developer-console > #user-switcher { grid-column: 2; }
  .console-dataset, .console-log-wrap { grid-column: 3; margin-top: 0; }
  .console-divider { display: none; }
}
@media (max-width: 850px) {
  .lab-header-inner, .lab-shell { width: min(100% - 28px, 720px); }
  .lab-shell { display: block; }
  .lab-sidebar { padding: 17px 0 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-intro, .sidebar-footnote { display: none; }
  .lab-nav { display: flex; gap: 5px; overflow-x: auto; padding-bottom: 3px; }
  .lab-nav button { flex: 0 0 auto; width: auto; padding: 9px 11px; font-size: 11px; white-space: nowrap; }
  .lab-nav button.is-active { box-shadow: none; }
  .nav-icon { width: auto; }
  .lab-main { padding: 26px 0 38px; }
  .developer-console { display: grid; grid-template-columns: 1fr 1fr; padding: 20px 0 30px; }
  .console-heading, .console-description { grid-column: 1 / -1; }
  .developer-console > .field-label, .developer-console > #user-search, .developer-console > #user-switcher { grid-column: 1 / -1; }
  .console-dataset, .console-log-wrap { grid-column: 1 / -1; }
  .console-log-wrap { margin-top: 18px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-grid, .profile-layout { grid-template-columns: 1fr; }
  .user-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .lab-header-inner { min-height: 66px; }
  .lab-header-meta { gap: 8px; }
  .lab-mode-badge { display: none; }
  .lab-language-switcher button { min-width: 32px; padding: 5px 6px; }
  .lab-main-topline, .page-heading { display: block; }
  .operation-status { max-width: none; margin-top: 13px; text-align: left; }
  .page-heading-actions { justify-content: flex-start; margin-top: 13px; }
  .metric-grid { gap: 8px; }
  .metric-card { padding: 13px; }
  .metric-card strong { font-size: 23px; }
  .panel { padding: 15px; }
  .quick-grid, .user-grid, .event-grid, .community-card-grid, .form-grid, .weight-grid { grid-template-columns: 1fr; }
  .form-field.full { grid-column: auto; }
  .event-card h3, .community-card h3 { font-size: 15px; }
}
