:root {
  --porcelain: #F2F4F7;
  --porcelain-deep: #E6E9EF;
  --ink: #12141A;
  --ink-soft: #3A3F4B;
  --ink-faint: #6B7280;
  --teal: #0A6B63;
  --teal-soft: #148A80;
  --teal-wash: rgba(10, 107, 99, 0.12);
  --warn: #C45C26;
  --warn-wash: rgba(196, 92, 38, 0.14);
  --line: rgba(18, 20, 26, 0.1);
  --line-strong: rgba(18, 20, 26, 0.18);
  --panel: rgba(255, 255, 255, 0.72);
  --font-display: "Syne", "Noto Sans SC", "Noto Sans JP", "Segoe UI", sans-serif;
  --font-ui: "Figtree", "Noto Sans SC", "Noto Sans JP", "Segoe UI", sans-serif;
  --radius: 14px;
  --balance-h: 40px;
  --composer-h: 88px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--porcelain);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.45;
  overflow-x: clip;
  scrollbar-width: thin;
  scrollbar-color: var(--teal) var(--porcelain-deep);
}

html::-webkit-scrollbar {
  width: 10px;
}

html::-webkit-scrollbar-track {
  background: var(--porcelain-deep);
}

html::-webkit-scrollbar-thumb {
  background: var(--teal);
  border-radius: 999px;
  border: 2px solid var(--porcelain-deep);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 12% -10%, rgba(10, 107, 99, 0.08), transparent 55%),
    radial-gradient(900px 500px at 90% 0%, rgba(196, 92, 38, 0.06), transparent 50%),
    var(--porcelain);
  color: var(--ink);
  overflow-x: clip;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}

a {
  color: var(--teal);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--teal-soft);
}

img {
  max-width: 100%;
  display: block;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

.lang {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.lang button {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-faint);
  min-width: 34px;
  height: 28px;
  padding: 0 6px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.04em;
}

.lang button[aria-pressed="true"] {
  color: var(--ink);
  border-color: var(--line-strong);
  background: #fff;
}

.desk {
  position: relative;
  z-index: 1;
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto var(--balance-h) minmax(0, 1fr);
  overflow: hidden;
}

.desk-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px 16px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(242, 244, 247, 0.88);
  backdrop-filter: blur(10px);
  min-height: 64px;
}

.brand-block {
  min-width: 0;
}

.brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.55rem, 2.4vw, 2rem);
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--ink);
  text-decoration: none;
}

.brand span {
  color: var(--teal);
}

.brand-line {
  margin: 4px 0 0;
  font-size: 0.86rem;
  color: var(--ink-soft);
}

.desk-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px 14px;
}

.desk-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
}

.desk-nav a:hover {
  color: var(--teal);
}

.desk-nav .cta {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  text-decoration: none;
}

.desk-nav .cta:hover {
  background: var(--teal-soft);
  color: #fff;
}

.balance-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 18px;
  background: var(--warn-wash);
  border-bottom: 1px solid rgba(196, 92, 38, 0.22);
  color: var(--warn);
  font-size: 0.86rem;
  font-weight: 650;
}

.balance-strip a {
  color: var(--warn);
  font-weight: 700;
}

.desk-body {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

.roster {
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.45);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.roster-head {
  padding: 14px 14px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.roster-list {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 4px 8px 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--teal) transparent;
}

.roster-list::-webkit-scrollbar {
  width: 8px;
}

.roster-list::-webkit-scrollbar-thumb {
  background: var(--teal);
  border-radius: 999px;
}

.agent-btn {
  width: 100%;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  position: relative;
}

.agent-btn:hover {
  background: rgba(255, 255, 255, 0.7);
}

.agent-btn.is-active {
  background: #fff;
  border-color: var(--line-strong);
}

.agent-btn.is-active::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 999px;
  background: var(--teal);
  animation: pulse-bar 1.6s ease-in-out infinite;
}

.agent-btn img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--porcelain-deep);
}

.agent-meta strong {
  display: block;
  font-size: 0.92rem;
  font-weight: 700;
}

.agent-meta span {
  display: block;
  font-size: 0.75rem;
  color: var(--ink-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-pane {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.08));
}

.transcript {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 22px 22px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--teal) transparent;
}

.transcript::-webkit-scrollbar {
  width: 8px;
}

.transcript::-webkit-scrollbar-thumb {
  background: var(--teal);
  border-radius: 999px;
}

.msg {
  max-width: min(680px, 92%);
  padding: 12px 14px;
  border-radius: 14px;
  animation: msg-in 0.35s ease both;
}

.msg-user {
  align-self: flex-end;
  background: #fff;
  border: 1px solid var(--line);
}

.msg-ai {
  align-self: flex-start;
  background: var(--teal-wash);
  border: 1px solid rgba(10, 107, 99, 0.18);
}

.msg-role {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 4px;
}

.msg p {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.composer {
  border-top: 1px solid var(--line);
  padding: 12px 16px 16px;
  background: rgba(242, 244, 247, 0.92);
  backdrop-filter: blur(8px);
}

.composer-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  max-width: 920px;
}

.composer textarea {
  width: 100%;
  min-height: 52px;
  max-height: 140px;
  resize: none;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 12px 14px;
  background: #fff;
  outline: none;
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.composer textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-wash);
  animation: focus-pulse 1.4s ease-in-out 1;
}

.composer button[type="submit"] {
  appearance: none;
  border: 0;
  height: 52px;
  padding: 0 18px;
  border-radius: 12px;
  background: var(--teal);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.composer button[type="submit"]:hover {
  background: var(--teal-soft);
}

.composer button[type="submit"]:disabled {
  opacity: 0.55;
  cursor: wait;
}

.composer-hint {
  margin: 8px 0 0;
  font-size: 0.78rem;
  color: var(--ink-faint);
}

.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(242, 244, 247, 0.9);
  backdrop-filter: blur(8px);
}

.topbar .brand {
  font-size: 1.45rem;
}

.top-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
}

.top-links a {
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}

.top-links a:hover,
.top-links a[aria-current="page"] {
  color: var(--teal);
}

.main {
  width: min(1080px, calc(100% - 36px));
  margin: 0 auto;
  padding: 36px 0 56px;
}

.foot {
  border-top: 1px solid var(--line);
  padding: 18px 22px;
  color: var(--ink-faint);
  font-size: 0.82rem;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  justify-content: space-between;
}

.foot a {
  color: var(--ink-soft);
  text-decoration: none;
}

h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin: 0 0 10px;
}

.lead {
  margin: 0 0 28px;
  max-width: 42rem;
  color: var(--ink-soft);
  font-size: 1.05rem;
}

.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}

.agent-tile {
  display: grid;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.agent-tile img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 18px;
  background: var(--porcelain-deep);
}

.agent-tile h2 {
  margin: 0;
  font-size: 1.1rem;
  font-family: var(--font-display);
}

.agent-tile p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.meter-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 28px;
  align-items: stretch;
  min-width: 0;
}

.meter-visual {
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fff;
  min-width: 0;
}

.meter-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  min-height: 280px;
}

.meter-panel {
  min-width: 0;
  display: grid;
  gap: 16px;
  align-content: start;
}

.meter-panel label {
  display: grid;
  gap: 8px;
  font-weight: 650;
}

.meter-panel input[type="range"] {
  width: 100%;
  accent-color: var(--teal);
}

.meter-readout {
  display: grid;
  gap: 8px;
  padding: 16px 0 0;
  border-top: 1px solid var(--line);
}

.meter-readout strong {
  font-family: var(--font-display);
  font-size: 1.8rem;
  letter-spacing: -0.03em;
}

.meter-readout span {
  color: var(--ink-soft);
}

.meter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  background: var(--teal);
  color: #fff;
}

.btn:hover {
  background: var(--teal-soft);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn-ghost:hover {
  border-color: var(--teal);
  color: var(--teal);
  background: transparent;
}

.btn-warn {
  background: var(--warn);
}

.btn-warn:hover {
  background: #d46930;
  color: #fff;
}

.note {
  min-height: 1.3em;
  color: var(--warn);
  font-size: 0.9rem;
  font-weight: 600;
}

.steps {
  display: grid;
  gap: 22px;
}

.step {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  min-width: 0;
}

.step-num {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--teal-wash);
  color: var(--teal);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.2rem;
}

.step h2 {
  margin: 0 0 6px;
  font-size: 1.15rem;
  font-family: var(--font-display);
}

.step p {
  margin: 0;
  color: var(--ink-soft);
}

.how-art {
  margin: 28px 0 0;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.how-art img {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
}

.auth-wrap {
  width: min(920px, calc(100% - 36px));
  margin: 0 auto;
  padding: 40px 0 64px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.9fr);
  gap: 28px;
  align-items: stretch;
}

.auth-copy h1 {
  margin-bottom: 8px;
}

.auth-copy p {
  margin: 0;
  color: var(--ink-soft);
}

.auth-visual {
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  min-height: 220px;
}

.auth-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  min-height: 220px;
}

.handshake-form {
  grid-column: 1 / -1;
  display: grid;
  gap: 14px;
  padding: 22px 0 0;
  border-top: 1px solid var(--line);
  max-width: 520px;
}

.handshake-form label {
  display: grid;
  gap: 6px;
  font-weight: 650;
  font-size: 0.92rem;
}

.handshake-form input {
  height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 0 12px;
  background: #fff;
}

.handshake-form input:focus {
  outline: 2px solid var(--teal-wash);
  border-color: var(--teal);
}

.captcha-row {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 12px;
  align-items: end;
}

.captcha-box {
  display: grid;
  gap: 8px;
}

.captcha-box canvas {
  width: 180px;
  height: 64px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  display: block;
}

.captcha-tools {
  display: flex;
  gap: 8px;
}

.captcha-tools button {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: #fff;
  border-radius: 8px;
  height: 34px;
  padding: 0 10px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 650;
}

.reg-rail {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 0;
  width: min(980px, calc(100% - 36px));
  margin: 36px auto 64px;
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.65);
  min-width: 0;
}

.reg-rail-side {
  background: linear-gradient(180deg, var(--teal), #08564f);
  color: #fff;
  padding: 28px 20px;
  display: grid;
  gap: 12px;
  align-content: start;
}

.reg-rail-side h1 {
  color: #fff;
  font-size: 1.55rem;
}

.reg-rail-side p {
  margin: 0;
  opacity: 0.9;
  font-size: 0.95rem;
}

.reg-rail-form {
  padding: 28px 24px;
  display: grid;
  gap: 14px;
  min-width: 0;
}

.reg-rail-form label {
  display: grid;
  gap: 6px;
  font-weight: 650;
  font-size: 0.92rem;
}

.reg-rail-form input {
  height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 0 12px;
  background: #fff;
}

.wave-captcha {
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #0f2f2c;
  width: 100%;
  max-width: 280px;
  height: 78px;
  display: block;
}

.err-page {
  min-height: 70vh;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 12px;
  padding: 40px 20px;
}

.err-page .code {
  font-family: var(--font-display);
  font-size: 4rem;
  letter-spacing: -0.04em;
  color: var(--teal);
  line-height: 1;
}

@keyframes msg-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes focus-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 3px var(--teal-wash);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(10, 107, 99, 0.18);
  }
}

@keyframes pulse-bar {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

@media (max-width: 900px) {
  .desk-body {
    grid-template-columns: 1fr;
  }

  .roster {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: 120px;
  }

  .roster-list {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 10px 10px;
  }

  .agent-btn {
    width: 168px;
    flex: 0 0 auto;
  }

  .agent-btn.is-active::before {
    left: 10px;
    right: 10px;
    top: auto;
    bottom: 4px;
    width: auto;
    height: 3px;
  }

  .meter-stage,
  .auth-wrap,
  .reg-rail {
    grid-template-columns: 1fr;
  }

  .reg-rail-side {
    padding: 22px;
  }

  .captcha-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .desk-top {
    grid-template-columns: 1fr;
    padding: 10px 12px;
    align-content: center;
  }

  .desk {
    grid-template-rows: auto var(--balance-h) minmax(0, 1fr);
  }

  .desk-nav {
    justify-content: flex-start;
  }

  .brand-line {
    display: none;
  }

  .composer-shell {
    grid-template-columns: 1fr;
  }

  .composer button[type="submit"] {
    width: 100%;
  }
}
