:root {
  --portal-red: #e11d2e;
  --portal-red-deep: #b91524;
  --portal-red-dark: #8f111d;
  --ink: #1f2937;
  --muted: #6b1f28;
  --line: #fee2e2;
  --panel: #ffffff;
  --font: "Manrope", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  min-height: 100%;
}

body {
  color: var(--ink);
  font-family: var(--font);
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 255, 255, 0.28), transparent 32%),
    linear-gradient(160deg, var(--portal-red) 0%, var(--portal-red-deep) 58%, var(--portal-red-dark) 100%);
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 0;
}

.shell {
  width: 100%;
  height: 100%;
  min-height: 100%;
  margin: 0;
  background: var(--panel);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.portal-header {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.22), transparent 30%),
    linear-gradient(135deg, var(--portal-red) 0%, var(--portal-red-deep) 100%);
  color: #fff;
  text-align: left;
  padding: 1.35rem 1.45rem 1.15rem;
  flex-shrink: 0;
}

.portal-header::after {
  content: "";
  position: absolute;
  right: -4rem;
  top: -5rem;
  width: 12rem;
  height: 12rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.11);
}

.brand, .title { position: relative; z-index: 1; }

.brand {
  margin: 0 0 0.25rem;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.86;
}

.title {
  margin: 0;
  font-size: clamp(1.7rem, 6vw, 2.25rem);
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0;
  text-shadow: 0 3px 10px rgba(0, 0, 0, 0.22);
}

.portal-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding: 0.9rem 1.1rem 0.85rem;
  background:
    radial-gradient(circle at 50% 0%, rgba(225, 29, 46, 0.10), transparent 36%),
    linear-gradient(180deg, #ffffff 0%, #fffafa 58%, #fff1f2 100%);
}

.guide-pane {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  clip-path: inset(0);
  width: min(100%, 23.5rem);
  margin: 0 auto;
  padding: 0.1rem 0.15rem 0.45rem;
  display: flex;
  flex-direction: column;
  isolation: isolate;
  position: relative;
  z-index: 0;
}

.guide-kicker {
  margin: 0;
  color: #b91c1c;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.guide-title {
  margin: 0.22rem 0 0;
  color: #8f111d;
  font-size: 1.05rem;
  line-height: 1.2;
  font-weight: 800;
}

.guide-sub {
  margin: 0.32rem 0 0;
  color: #6b7280;
  font-size: 0.74rem;
  line-height: 1.35;
  font-weight: 600;
}

.lang-support {
  flex: 0 0 auto;
  position: relative;
  z-index: 2;
  width: min(100%, 23.5rem);
  margin: 0 auto 0.4rem;
  padding: 0.42rem 0.7rem;
  border: 1px solid rgba(225, 29, 46, 0.14);
  border-radius: 0.75rem;
  background: #fff1f2;
  color: #9f1239;
  font-size: 0.72rem;
  line-height: 1.35;
  font-weight: 700;
  text-align: center;
}

.sample-list {
  list-style: none;
  margin: 0.55rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.38rem;
}

.sample-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.42rem 0.58rem;
  border: 1px solid rgba(225, 29, 46, 0.14);
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 6px 14px rgba(145, 16, 28, 0.05);
}

.sample-tag {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.28rem;
  min-width: 4.9rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: #fff1f2;
  color: #991b1b;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.sample-line {
  color: #374151;
  font-size: 0.78rem;
  line-height: 1.32;
  font-weight: 700;
  text-align: left;
}

.ai-disclaimer {
  flex: 0 0 auto;
  position: relative;
  z-index: 2;
  width: min(100%, 23.5rem);
  margin: 0 auto 0.35rem;
  padding: 0.5rem 0.7rem 0.55rem;
  border: 1px dashed rgba(153, 27, 27, 0.28);
  border-radius: 0.8rem;
  background: #fff7ed;
}

.disclaimer-title {
  margin: 0 0 0.18rem;
  color: #9a3412;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ai-disclaimer p:last-child {
  margin: 0;
  color: #7c2d12;
  font-size: 0.7rem;
  line-height: 1.38;
  font-weight: 600;
}

.call-dock {
  flex: 0 0 auto;
  position: relative;
  z-index: 3;
  width: min(100%, 23.5rem);
  margin: 0 auto;
  padding: 0.55rem 0.2rem 0.1rem;
  border-top: 1px solid rgba(254, 202, 202, 0.95);
  background: linear-gradient(180deg, rgba(255, 250, 250, 0.97) 0%, #fff5f5 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  text-align: center;
}

.call-panel {
  width: min(100%, 22rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  text-align: center;
}

.call-btn,
.end-btn {
  border: 0;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
  background: transparent;
  line-height: 0;
  position: relative;
  overflow: visible;
  width: auto;
  min-width: 15rem;
  max-width: 17.75rem;
  margin: 0 auto;
  text-align: center;
  border-radius: 0;
  box-shadow: none !important;
}

.call-btn-art,
.end-btn-art {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
  user-select: none;
  background: transparent;
}

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

.device-pickers {
  width: min(100%, 19.5rem);
  display: grid;
  gap: 0.55rem;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 24px rgba(145, 16, 28, 0.08);
}

.device-field {
  display: grid;
  gap: 0.35rem;
  text-align: left;
}

.device-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #991b1b;
}

.device-field select {
  width: 100%;
  padding: 0.58rem 0.7rem;
  border: 1px solid #fecaca;
  border-radius: 0.75rem;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  appearance: auto;
}

.device-field select:focus {
  outline: 3px solid rgba(225, 29, 46, 0.2);
  outline-offset: 1px;
  border-color: var(--portal-red);
}

.device-field select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: #f9fafb;
}

.status {
  margin: 0;
  min-height: 1.35rem;
  max-width: 18.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.52rem 0.9rem;
  border-radius: 999px;
  background: #fff1f2;
  color: #7f1d1d;
  font-size: 0.92rem;
  line-height: 1.25;
  font-weight: 800;
}

.timer {
  margin: 0;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
  color: #991b1b;
  font-size: 1.45rem;
  font-weight: 800;
}

.meter-wrap {
  width: min(100%, 18.5rem);
  height: 0.46rem;
  margin-top: 0.1rem;
  border-radius: 999px;
  background: #fee2e2;
  overflow: hidden;
}

.meter-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #16a34a 0%, #22c55e 52%, #86efac 100%);
  transition: width 80ms linear;
}

.meter-wrap.is-websocket .meter-bar {
  background: linear-gradient(90deg, var(--portal-red-dark) 0%, var(--portal-red) 52%, #f87171 100%);
}

.debug {
  display: none !important;
}

.hidden { display: none !important; }

@media (min-width: 680px) {
  .shell {
    width: min(100%, 30rem);
    height: 100%;
    min-height: 100%;
  }
}

body.embedded {
  background: #ffffff;
}

body.embedded .shell {
  width: 100%;
  height: 100%;
  min-height: 100%;
  box-shadow: none;
  border-radius: 0;
}

body.embedded .portal-header {
  display: none;
}

body.embedded .portal-body {
  min-height: 0;
  height: 100%;
  padding: 0.75rem 0.95rem 0.65rem;
}

body.embedded .call-dock {
  width: min(100%, 22.5rem);
  gap: 0.62rem;
}

@media (max-width: 380px) {
  .portal-header { padding: 1.1rem 1.15rem 1rem; }
  .portal-body { padding: 0.75rem 0.85rem 0.65rem; }
  .sample-tag { flex-basis: 4.1rem; }
  .call-btn,
  .end-btn {
    min-width: 13.25rem;
    max-width: 15.5rem;
  }
  .device-pickers { padding: 0.7rem; }
}

@media (max-height: 720px) {
  .guide-title { font-size: 1rem; }
  .sample-list li { padding: 0.46rem 0.6rem; }
  .sample-line { font-size: 0.78rem; }
  .ai-disclaimer { padding: 0.62rem 0.72rem; }
  .call-dock { padding-top: 0.55rem; gap: 0.55rem; }
  .lang-support { margin-bottom: 0.28rem; padding: 0.32rem 0.55rem; }
}
