:root {
  color-scheme: dark;
  --ink: #10201f;
  --page: #132726;
  --page-deep: #0d1c22;
  --panel: #203b3a;
  --panel-soft: #294947;
  --panel-blue: #1f3b4d;
  --line: rgba(190, 236, 226, 0.2);
  --line-strong: rgba(173, 232, 244, 0.38);
  --text: #effbf7;
  --muted: #b5d6d0;
  --blue-light: #b8e4ff;
  --blue: #8ecdf2;
  --blue-deep: #5b9dcc;
  --green-light: #c7f4dc;
  --green: #8edfb5;
  --green-deep: #62b790;
  --peach: #ffd7c8;
  --rose: #ffeaf2;
  --level-stable: #c7f4dc;
  --level-watch: #b8e4ff;
  --level-stress: #8ecdf2;
  --level-risk: #5b9dcc;
  --yellow: var(--level-watch);
  --red: var(--level-risk);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top, rgba(255, 236, 244, 0.12), transparent 18%),
    radial-gradient(circle at 20% 20%, rgba(255, 215, 200, 0.08), transparent 22%),
    linear-gradient(145deg, rgba(184, 228, 255, 0.14), transparent 32%),
    linear-gradient(325deg, rgba(199, 244, 220, 0.12), transparent 42%),
    linear-gradient(180deg, var(--page) 0%, var(--page-deep) 100%);
  color: var(--text);
  text-transform: lowercase;
}

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 36px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 10px;
  background: var(--green-light);
  color: var(--ink);
  font-weight: 800;
}

.topbar-meta {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.topbar-meta::before {
  content: "♡";
  margin-right: 6px;
  color: var(--green-light);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 24px;
  padding: 18px 0 22px;
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--green-light);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1,
h2,
.eyebrow,
strong,
.brand {
  font-weight: 800;
}

h1 {
  max-width: 680px;
  margin-bottom: 12px;
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  line-height: 1;
}

h2 {
  margin-bottom: 0;
  font-size: 1.12rem;
  line-height: 1.25;
}

.panel-heading h2::after {
  content: "♡";
  margin-left: 6px;
  color: var(--green-light);
  font-size: 0.88rem;
}

.hero-copy {
  max-width: 650px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 200px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(31, 59, 77, 0.72);
  color: var(--blue-light);
  font-size: 0.9rem;
  font-weight: 750;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(41, 73, 71, 0.95), rgba(32, 59, 58, 0.92));
  box-shadow: 0 18px 42px rgba(4, 17, 20, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  padding: 18px;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.panel:hover {
  transform: translateY(-1px);
  box-shadow: 0 22px 44px rgba(3, 14, 18, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.cover-screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 32px;
  background: radial-gradient(circle at top, rgba(255, 236, 244, 0.12), transparent 18%),
    radial-gradient(circle at 20% 20%, rgba(255, 215, 200, 0.08), transparent 22%),
    linear-gradient(145deg, rgba(184, 228, 255, 0.14), transparent 32%),
    linear-gradient(325deg, rgba(199, 244, 220, 0.12), transparent 42%),
    linear-gradient(180deg, var(--page) 0%, var(--page-deep) 100%);
  color: var(--text);
  z-index: 20;
}

.cover-inner {
  text-align: center;
  max-width: 520px;
  gap: 20px;
  display: grid;
}

.cover-screen h1 {
  font-size: clamp(3rem, 8vw, 5rem);
  margin: 0;
}

.cover-screen p {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.8;
  margin: 0;
}

.start-button {
  margin-top: 48px;
  min-width: 180px;
  padding: 16px 24px;
  border: none;
  border-radius: 99px;
  background: linear-gradient(135deg, var(--green-light), var(--blue-light));
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
  transition: transform 160ms ease, filter 160ms ease;
}

.start-button:hover {
  transform: translateY(-2px);
  filter: brightness(1.02);
}

.hidden {
  display: none !important;
}

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 280px;
  padding: 24px 18px;
  background: rgba(19, 39, 38, 0.96);
  border-right: 1px solid rgba(190, 236, 226, 0.12);
  transform: translateX(-100%);
  transition: transform 180ms ease;
  z-index: 25;
}

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

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 26px;
}

.sidebar-top strong {
  color: var(--text);
  font-size: 0.95rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.sidebar-close {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(190, 236, 226, 0.18);
  border-radius: 12px;
  background: rgba(13, 28, 34, 0.7);
  color: var(--text);
  font-size: 1.15rem;
  cursor: pointer;
}

.sidebar-nav {
  display: grid;
  gap: 12px;
}

.nav-link {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 16px;
  padding: 14px 16px;
  background: rgba(31, 59, 77, 0.75);
  color: var(--text);
  text-align: left;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
}

.nav-link.active,
.nav-link:hover {
  border-color: rgba(142, 223, 181, 0.28);
  background: linear-gradient(135deg, rgba(142, 205, 242, 0.16), rgba(199, 244, 220, 0.1));
}

.sidebar-handle {
  position: fixed;
  left: 0;
  top: calc(50% - 42px);
  width: 42px;
  height: 84px;
  border-top-right-radius: 20px;
  border-bottom-right-radius: 20px;
  background: rgba(19, 39, 38, 0.92);
  display: grid;
  place-items: center;
  z-index: 30;
  cursor: pointer;
  transition: background 160ms ease;
}

.sidebar-handle:hover {
  background: rgba(19, 39, 38, 1);
}

.sidebar-handle span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  letter-spacing: 0.22em;
  color: var(--blue-light);
  font-size: 0.8rem;
  font-weight: 800;
}

.menu-button {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
}

.page-content {
  display: grid;
  gap: 26px;
}

.page-section {
  display: none;
}

.page-section.active {
  display: block;
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 6px;
}

.section-header h2 {
  margin: 0;
  font-size: 1.5rem;
}

.history-panel {
  grid-column: span 12;
}

.pattern-panel {
  grid-column: span 12;
}

.form-panel {
  grid-column: span 7;
}

.gauge-panel {
  grid-column: span 5;
  background: rgba(31, 59, 77, 0.82);
}

.pattern-panel {
  grid-column: span 7;
}

.history-panel {
  grid-column: span 5;
}

.trend-panel {
  grid-column: span 7;
}

.twin-panel {
  grid-column: span 5;
}

.module-panel {
  grid-column: span 4;
}

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

.panel-heading.compact {
  margin-bottom: 14px;
}

#scoreValue {
  color: var(--blue-light);
  font-size: 1.9rem;
  line-height: 1;
}

.level-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.level-pill {
  display: grid;
  min-height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-align: center;
}

.level-pill.active {
  background: linear-gradient(135deg, var(--green-light), var(--blue-light));
  color: var(--ink);
}

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

.metric-control {
  min-width: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(41, 73, 71, 0.72);
  padding: 14px;
}

.metric-control legend {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 0 12px;
}

.metric-control legend span {
  color: var(--text);
  font-weight: 800;
}

.metric-control small,
.note-field span,
.gauge-core small {
  color: var(--muted);
}

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

.choice-row label {
  min-width: 0;
}

.choice-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice-row span {
  display: grid;
  min-height: 42px;
  place-items: center;
  border: 1px solid rgba(190, 236, 226, 0.15);
  border-radius: 10px;
  background: rgba(16, 32, 31, 0.42);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
}

.choice-row input:checked + span {
  border-color: rgba(199, 244, 220, 0.72);
  background: linear-gradient(135deg, var(--green-light), var(--blue-light));
  color: var(--ink);
}

.number-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.number-grid label {
  display: grid;
  gap: 7px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(31, 59, 77, 0.42);
  padding: 12px;
}

.number-grid span {
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 800;
}

.number-grid input {
  width: 100%;
  border: 1px solid rgba(190, 236, 226, 0.18);
  border-radius: 10px;
  background: rgba(13, 28, 34, 0.72);
  color: var(--text);
  padding: 10px;
  outline: none;
}

.number-grid small {
  color: var(--muted);
  font-size: 0.75rem;
}

.toggle-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.toggle-card {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(31, 59, 77, 0.5);
  padding: 12px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 760;
}

.toggle-card:has(input:checked) {
  border-color: var(--line-strong);
  background: rgba(142, 223, 181, 0.16);
  color: var(--text);
}

.toggle-card input {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  accent-color: var(--green);
}

.note-field {
  display: grid;
  gap: 8px;
}

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(13, 28, 34, 0.78);
  color: var(--text);
  padding: 12px;
  outline: none;
}

textarea:focus,
.metric-control:focus-within {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(184, 228, 255, 0.12);
}

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

button {
  min-height: 42px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--green-light), var(--peach));
  color: var(--ink);
  padding: 0 16px;
  font-weight: 850;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(142, 223, 181, 0.15);
  transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(142, 223, 181, 0.22);
  filter: saturate(1.03);
}

.ghost-button {
  border: 1px solid var(--line);
  background: rgba(184, 228, 255, 0.08);
  color: var(--blue-light);
}

.ghost-button:hover {
  background: rgba(184, 228, 255, 0.14);
}

.gauge {
  display: grid;
  place-items: center;
  padding: 10px 0 20px;
}

.gauge-ring {
  display: grid;
  width: min(240px, 66vw);
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--green) 0deg, rgba(190, 236, 226, 0.16) 0deg);
  transition: background 220ms ease;
}

.gauge-core {
  display: grid;
  width: 76%;
  aspect-ratio: 1;
  place-items: center;
  align-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(13, 28, 34, 0.92);
}

.gauge-core span {
  color: var(--text);
  font-size: 2.85rem;
  font-weight: 850;
  line-height: 1;
}

.battery-block {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.battery-shell {
  height: 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(13, 28, 34, 0.5);
  padding: 3px;
}

#batteryFill {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green-light), var(--blue-light));
  transition: width 220ms ease;
}

#batteryText {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.signal-list,
.pattern-stack,
.history-list {
  display: grid;
  gap: 10px;
}

.signal-list p,
.pattern-card,
.history-item {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(13, 28, 34, 0.38);
  padding: 12px;
  color: var(--muted);
  line-height: 1.45;
}

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

.pattern-card {
  min-height: 104px;
}

.pattern-card strong,
.history-item strong {
  display: block;
  margin-bottom: 5px;
  color: var(--text);
}

.pattern-card.green,
.pattern-card.stable {
  border-top: 4px solid var(--green);
}

.pattern-card.yellow,
.pattern-card.watch {
  border-top: 4px solid var(--blue-light);
}

.pattern-card.red,
.pattern-card.stress,
.pattern-card.risk {
  border-top: 4px solid var(--blue-deep);
}

.trend-callout,
.insight-card {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(13, 28, 34, 0.38);
  color: var(--muted);
  line-height: 1.55;
  padding: 13px;
}

.crack-graph {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(184, 228, 255, 0.06);
  overflow: hidden;
}

.crack-graph svg {
  display: block;
  width: 100%;
  height: 190px;
}

.glass-line,
.cracks path {
  fill: none;
  stroke: rgba(199, 244, 220, 0.34);
  stroke-width: 2;
}

.risk-line {
  fill: none;
  stroke: var(--blue-light);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 5;
}

.cracks path {
  stroke: rgba(142, 205, 242, 0.72);
  stroke-width: 1.5;
}

.avatar-stage {
  display: grid;
  place-items: center;
  gap: 16px;
  min-height: 276px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(13, 28, 34, 0.3);
  padding: 18px;
  text-align: center;
}

.avatar {
  position: relative;
  width: 130px;
  height: 170px;
  transition: transform 220ms ease;
}

.avatar-head,
.avatar-body,
.avatar-pack {
  position: absolute;
  display: block;
}

.avatar-head {
  left: 39px;
  top: 8px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--green-light);
}

.avatar-head::before,
.avatar-head::after {
  position: absolute;
  top: 24px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink);
  content: "";
}

.avatar-head::before {
  left: 15px;
}

.avatar-head::after {
  right: 15px;
}

.avatar-body {
  left: 32px;
  top: 70px;
  width: 68px;
  height: 86px;
  border-radius: 24px 24px 14px 14px;
  background: var(--blue-light);
}

.avatar-pack {
  right: 8px;
  top: 80px;
  width: 34px;
  height: 58px;
  border-radius: 14px;
  background: var(--green-deep);
  transform-origin: top left;
}

.avatar.watch {
  transform: rotate(2deg);
}

.avatar.stress {
  transform: rotate(6deg) translateY(8px);
}

.avatar.risk {
  transform: rotate(10deg) translateY(18px);
}

.avatar.stress .avatar-pack,
.avatar.risk .avatar-pack {
  transform: scale(1.18);
}

.avatar.risk .avatar-head {
  box-shadow: inset 0 -12px 0 rgba(91, 157, 204, 0.45);
}

.forecast-card {
  display: grid;
  min-height: 84px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(199, 244, 220, 0.18), rgba(184, 228, 255, 0.13));
  color: var(--text);
  font-size: 1.3rem;
  font-weight: 850;
  margin-bottom: 10px;
}

.forecast-card.busy {
  background: rgba(184, 228, 255, 0.16);
}

.forecast-card.storm {
  background: rgba(91, 157, 204, 0.24);
}

.upload-card {
  display: grid;
  place-items: center;
  min-height: 96px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  background: rgba(184, 228, 255, 0.08);
  color: var(--blue-light);
  font-weight: 850;
  margin-bottom: 10px;
  text-align: center;
}

.upload-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.backpack-layout {
  display: grid;
  grid-template-columns: 128px 1fr;
  gap: 14px;
  align-items: center;
}

.backpack-visual {
  position: relative;
  height: 146px;
  border: 3px solid var(--blue-light);
  border-radius: 30px 30px 18px 18px;
  background: rgba(13, 28, 34, 0.45);
  overflow: hidden;
}

.backpack-visual::before {
  position: absolute;
  top: -20px;
  left: 34px;
  width: 52px;
  height: 30px;
  border: 3px solid var(--green-light);
  border-bottom: 0;
  border-radius: 24px 24px 0 0;
  content: "";
}

.backpack-fill {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 0;
  background: linear-gradient(0deg, var(--green-deep), var(--blue-light));
  transition: height 220ms ease;
}

.backpack-items {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 760;
}

.backpack-items input {
  accent-color: var(--green);
}

.backpack-panel .insight-card,
.language-panel .insight-card {
  margin-top: 12px;
}

.twin-chat-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(13, 28, 34, 0.42);
  padding: 10px;
}

.twin-chat-log {
  display: grid;
  gap: 8px;
  max-height: 200px;
  overflow: auto;
  margin-bottom: 10px;
}

.twin-chat-bubble {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(41, 73, 71, 0.95), rgba(31, 59, 77, 0.95));
  color: var(--text);
  padding: 10px;
  line-height: 1.45;
  font-size: 0.92rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.twin-chat-bubble.user {
  background: rgba(199, 244, 220, 0.12);
  color: var(--text);
}

.twin-chat-controls {
  display: grid;
  gap: 8px;
}

.twin-chat-controls textarea {
  min-height: 56px;
  resize: vertical;
}

.twin-chat-controls button {
  justify-self: start;
}

.history-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.history-item small {
  color: var(--muted);
}

@media (max-width: 980px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .form-panel,
  .gauge-panel,
  .pattern-panel,
  .history-panel,
  .trend-panel,
  .twin-panel,
  .module-panel {
    grid-column: auto;
  }
}

@media (max-width: 760px) {
  .hero {
    grid-template-columns: 1fr;
    padding-top: 18px;
  }

  .metric-grid,
  .number-grid,
  .pattern-stack {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 20px, 1120px);
  }

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

  .panel {
    padding: 15px;
  }

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

  .toggle-grid,
  .history-item,
  .backpack-layout {
    grid-template-columns: 1fr;
  }
}
