:root {
  --text: #0e1231;
  --muted: #6e7099;
  --panel: rgba(255, 255, 255, 0.72);
  --line: rgba(110, 112, 153, 0.2);
  --shadow: 0 20px 70px rgba(64, 62, 120, 0.16);
  --shadow-tight: 0 10px 28px rgba(45, 43, 82, 0.1);
  --indigo: #4b46db;
  --indigo-soft: #ecebff;
  --orange: #f47c36;
  --orange-soft: #fff0e7;
  --violet: #8b79ff;
  --violet-soft: #f0edff;
  --brown: #6f5847;
  --brown-soft: #eee7df;
  --green: #1d9b78;
}

/* Create screen rebuild: compact app workflow, not nested cards. */
.create-screen {
  --create-surface: rgba(255, 255, 255, 0.82);
  --create-line: rgba(104, 105, 145, 0.16);
  --create-shadow: 0 14px 34px rgba(38, 37, 63, 0.08);
  display: grid;
  gap: 12px;
  width: 100%;
  min-width: 0;
}

.create-appbar {
  position: sticky;
  top: 0;
  z-index: 12;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--create-line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 24px rgba(45, 43, 82, 0.08);
  backdrop-filter: blur(18px);
}

.back-button,
.round-action {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(110, 112, 153, 0.18);
  border-radius: 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.76);
  font-size: 20px;
  font-weight: 850;
  box-shadow: 0 8px 18px rgba(34, 32, 64, 0.08);
}

.draft-title {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.draft-title span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.draft-title input {
  width: 100%;
  min-width: 0;
  border: 0;
  padding: 0;
  color: var(--text);
  background: transparent;
  font-size: 20px;
  line-height: 1.15;
  font-weight: 900;
}

.draft-title input:focus {
  outline: 0;
}

.create-app-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pill-action {
  color: var(--orange);
}

.heart-action {
  color: var(--indigo);
}

.create-picker {
  display: grid;
  gap: 0;
  border: 1px solid var(--create-line);
  border-radius: 18px;
  background: var(--create-surface);
  box-shadow: var(--create-shadow);
  overflow: hidden;
}

.picker-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 10px;
  min-height: 66px;
  padding: 10px 14px;
}

.picker-row + .picker-row {
  border-top: 1px solid var(--create-line);
}

.picker-row > strong {
  color: var(--text);
  font-size: 15px;
  font-weight: 900;
}

.picker-row > em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 850;
  text-align: right;
  white-space: nowrap;
}

.picker-scroll {
  display: flex;
  min-width: 0;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.purpose-cluster {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
}

.purpose-cluster span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.create-picker .chip {
  min-height: 34px;
  padding: 0 13px;
  border-radius: 14px;
  font-size: 13px;
}

.create-device-strip {
  display: flex;
  min-width: 0;
  gap: 8px;
  overflow-x: auto;
}

.create-device-strip .device-button {
  flex: 0 0 auto;
  width: 50px;
  height: 50px;
  border-radius: 15px;
}

.create-device-strip .device-button img {
  width: 31px;
  height: 31px;
}

.create-panel {
  min-width: 0;
  border: 1px solid var(--create-line);
  border-radius: 18px;
  padding: 14px;
  background: var(--create-surface);
  box-shadow: var(--create-shadow);
}

.create-section-head h2 {
  margin: 0;
  font-size: 19px;
  line-height: 1.2;
  font-weight: 900;
}

.create-section-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.segment-section .section-heading {
  align-items: center;
  margin-bottom: 10px;
}

.segment-table-wrap {
  overflow: auto;
  border: 1px solid var(--create-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.68);
}

.segment-table {
  width: 100%;
  min-width: 640px;
  border-collapse: separate;
  border-spacing: 0;
}

.segment-table th,
.segment-table td {
  height: 46px;
  border-right: 1px solid var(--create-line);
  border-bottom: 1px solid var(--create-line);
  padding: 0 12px;
  text-align: left;
  vertical-align: middle;
}

.segment-table th:last-child,
.segment-table td:last-child {
  border-right: 0;
}

.segment-table tr:last-child th,
.segment-table tr:last-child td {
  border-bottom: 0;
}

.segment-table thead th {
  background: #eff1f8;
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.segment-table th:first-child {
  width: 132px;
  background: #f8f8fc;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.segment-table [data-long-action] {
  cursor: context-menu;
}

.segment-table [data-long-action]:not([data-disabled="true"]):hover {
  background: rgba(244, 246, 252, 0.98);
  box-shadow: inset 3px 0 0 rgba(84, 76, 224, 0.56);
}

.segment-table input,
.segment-table .cell-input {
  width: 100%;
  min-height: 34px;
  border: 0;
  border-radius: 9px;
  padding: 0 8px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
}

.segment-table input:focus {
  outline: 0;
  background: white;
  box-shadow: inset 0 0 0 1px rgba(75, 70, 219, 0.22);
}

.table-remove {
  display: none;
}

.review-grid {
  display: grid;
  gap: 10px;
}

.score-row,
.focus-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 10px;
  min-height: 42px;
}

.focus-row {
  grid-template-columns: 82px 126px;
  justify-content: start;
}

.score-row span,
.focus-row span {
  color: var(--text);
  font-size: 14px;
  font-weight: 850;
}

.score-row strong {
  color: var(--indigo);
  font-size: 14px;
  font-weight: 900;
  text-align: right;
}

.segment-review-list {
  display: grid;
  gap: 14px;
}

.segment-review-card {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid #e2e6ef;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 24px rgba(20, 24, 44, 0.06);
}

.segment-review-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 4px;
}

.segment-review-head strong {
  color: #151936;
  font-size: 18px;
  line-height: 1.25;
  font-weight: 850;
}

.segment-review-head span {
  color: #6b7190;
  font-size: 13px;
  font-weight: 760;
}

.review-matrix,
.review-meta-grid {
  display: grid;
  gap: 8px;
}

.review-meta-grid {
  padding-top: 12px;
  border-top: 1px solid #edf0f6;
}

.bipolar-row {
  display: grid;
  grid-template-columns: minmax(96px, 0.95fr) minmax(180px, 1.4fr) minmax(96px, 0.95fr);
  align-items: center;
  gap: 12px;
  min-height: 38px;
}

.negative-label,
.positive-label {
  color: #4e5575;
  font-size: 13px;
  line-height: 1.35;
  font-weight: 700;
}

.positive-label {
  text-align: right;
}

.bipolar-cells {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(24px, 1fr);
  gap: 5px;
  padding: 5px;
  border: 1px solid #e6e9f2;
  border-radius: 12px;
  background: #f6f7fb;
}

.bipolar-cells button {
  position: relative;
  min-width: 0;
  height: 24px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  transition: background 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.bipolar-cells button:hover {
  background: #e9ecf7;
}

.bipolar-cells button::after {
  content: "";
  position: absolute;
  inset: 8px 5px;
  border-radius: 999px;
  background: #c5cad9;
}

.bipolar-cells button.is-selected {
  background: #4b46db;
  box-shadow: 0 6px 14px rgba(75, 70, 219, 0.22);
}

.bipolar-cells button.is-selected::after {
  inset: 6px;
  background: #fff;
}

.focus-duration-grid {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid #edf0f6;
}

.duration-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
}

.duration-row strong {
  color: #151936;
  font-size: 13px;
  line-height: 30px;
  font-weight: 820;
}

.duration-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.duration-options button {
  min-width: 42px;
  height: 30px;
  border: 1px solid #dfe3ee;
  border-radius: 10px;
  color: #515978;
  background: #fff;
  font-size: 12px;
  font-weight: 760;
  transition: border-color 120ms ease, color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.duration-options button:hover {
  border-color: #b9c0d5;
  background: #f8f9fc;
}

.duration-options button.is-selected {
  border-color: #4b46db;
  color: #fff;
  background: #4b46db;
  box-shadow: 0 6px 14px rgba(75, 70, 219, 0.18);
}

.feedback-list {
  display: grid;
  gap: 8px;
}

.feedback-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
  padding: 9px;
  border: 1px solid var(--create-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.58);
}

.feedback-card textarea {
  min-height: 48px;
  border: 0;
  resize: vertical;
  background: transparent;
  font-size: 13px;
  line-height: 1.45;
  font-weight: 700;
}

.create-savebar {
  position: sticky;
  bottom: 10px;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--create-line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 28px rgba(38, 37, 63, 0.1);
  backdrop-filter: blur(18px);
}

.create-savebar span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 780px) {
  .create-screen {
    gap: 10px;
  }

  .create-appbar {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    border-radius: 14px;
    padding: 8px;
  }

  .back-button,
  .round-action {
    width: 38px;
    height: 38px;
    border-radius: 13px;
    font-size: 18px;
  }

  .draft-title input {
    font-size: 18px;
  }

  .picker-row {
    grid-template-columns: 70px minmax(0, 1fr) 34px;
    min-height: 58px;
    gap: 8px;
    padding: 8px 10px;
  }

  .picker-row > strong {
    font-size: 13px;
  }

  .purpose-cluster span {
    display: none;
  }

  .create-picker .chip {
    min-height: 30px;
    padding: 0 10px;
    border-radius: 12px;
    font-size: 12px;
  }

  .create-device-strip .device-button {
    width: 44px;
    height: 44px;
    border-radius: 13px;
  }

  .create-device-strip .device-button img {
    width: 27px;
    height: 27px;
  }

  .create-panel {
    border-radius: 16px;
    padding: 12px;
  }

  .segment-table {
    min-width: 560px;
  }

  .create-savebar {
    bottom: 88px;
  }
}

@media (max-width: 520px) {
  .create-appbar,
  .create-picker,
  .create-panel,
  .create-savebar {
    border-radius: 14px;
  }

  .create-app-actions {
    gap: 6px;
  }

  .picker-row {
    grid-template-columns: 62px minmax(0, 1fr) 30px;
  }

  .picker-row > em {
    font-size: 11px;
  }

  .segment-section .section-heading {
    display: grid;
    gap: 8px;
  }

  .segment-section .inline-actions {
    justify-content: start;
  }

  .score-row {
    grid-template-columns: 70px minmax(0, 1fr) 28px;
  }

  .focus-row {
    grid-template-columns: 70px 116px;
  }

  .create-savebar {
    grid-template-columns: 1fr;
  }

  .create-savebar .primary-button {
    width: 100%;
  }
}

.phase-original-shell {
  min-height: 100vh;
  margin: 0;
  background: #f7f8fb;
  overflow: hidden;
}

.phase-original-frame {
  display: block;
  width: 100%;
  height: 100vh;
  min-height: 100vh;
  border: 0;
  background: #f7f8fb;
  overflow: hidden;
}

.shell:has(.phase-original-frame) {
  max-width: none;
  min-height: 100vh;
  padding: 0;
  background: #f7f8fb;
}

.shell:has(.phase-original-frame) .screen {
  display: block;
}

html:has(.phase-original-frame),
html:has(body.is-phase-route),
body:has(.phase-original-frame) {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

body.is-phase-route {
  scrollbar-width: none;
  -ms-overflow-style: none;
  background: #f7f8fb;
}

html:has(.phase-original-frame)::-webkit-scrollbar,
html:has(body.is-phase-route)::-webkit-scrollbar,
body:has(.phase-original-frame)::-webkit-scrollbar,
body.is-phase-route::-webkit-scrollbar,
body.is-phase-route *::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  background:
    radial-gradient(circle at 16% 6%, rgba(139, 121, 255, 0.12), transparent 26%),
    radial-gradient(circle at 84% 12%, rgba(111, 88, 71, 0.11), transparent 24%),
    linear-gradient(155deg, #f9fbff 0%, #f6f4f0 58%, #fff8f4 100%);
}

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

button {
  cursor: pointer;
}

.shell {
  width: 100%;
  max-width: 1120px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 14px 16px 96px;
  position: relative;
}

.glass {
  border: 1px solid rgba(255, 255, 255, 0.82);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 14px;
}

.app-header h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.08;
  font-weight: 800;
}

.app-header p {
  margin: 4px 0 0;
  color: #7b7ec1;
  font-size: 16px;
}

.header-inventory-button {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  padding: 0 18px;
  color: white;
  background: linear-gradient(135deg, #4b46db, #635fec);
  box-shadow: 0 12px 24px rgba(75, 70, 219, 0.24);
  font-weight: 850;
  white-space: nowrap;
}

.supplement-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.header-chain-button {
  min-height: 44px;
  border: 1px solid rgba(75, 70, 219, 0.22);
  border-radius: 12px;
  padding: 0 18px;
  color: #4b46db;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 10px 22px rgba(31, 35, 71, 0.08);
  font-weight: 850;
  white-space: nowrap;
}

.header-actions,
.editor-icons,
.inline-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-button {
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  color: var(--text);
  background: rgba(255, 255, 255, 0.75);
  box-shadow: 0 12px 30px rgba(51, 49, 105, 0.12), inset 0 0 0 1px rgba(255, 255, 255, 0.95);
}

.screen {
  display: grid;
  gap: 12px;
}

.purpose-home {
  display: grid;
  gap: 12px;
}

.home-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.home-kicker {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 820;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.home-topbar h1 {
  margin: 2px 0 0;
  font-size: 26px;
  line-height: 1.05;
  font-weight: 900;
}

.home-add {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 14px;
  color: white;
  background: linear-gradient(135deg, #4b46db, #635fec);
  box-shadow: 0 12px 24px rgba(75, 70, 219, 0.24);
  font-size: 27px;
  line-height: 1;
  font-weight: 540;
}

.category-rail {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  border-radius: 16px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-tight);
}

.category-pill {
  min-width: 0;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.58);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.84);
  font-size: 13px;
  font-weight: 850;
}

.category-pill.is-active {
  color: white;
}

.category-pill.orange.is-active {
  background: var(--orange);
}

.category-pill.brown.is-active {
  background: var(--brown);
}

.category-pill.violet.is-active {
  background: var(--violet);
}

.purpose-filter {
  display: grid;
  gap: 12px;
  border-radius: 18px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: var(--shadow-tight);
}

.filter-head,
.filter-block-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.filter-head strong {
  display: block;
  font-size: 16px;
  line-height: 1.2;
}

.filter-head span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.filter-block {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.tag-inline,
.device-filter-block {
  display: grid;
  align-items: center;
  gap: 12px;
  border-top: 1px solid rgba(110, 112, 153, 0.13);
  padding-top: 12px;
}

.tag-inline {
  grid-template-columns: 54px auto 1px minmax(0, 1fr) auto;
}

.device-filter-block {
  grid-template-columns: 54px minmax(0, 1fr) auto;
}

.tag-inline .chip-list {
  grid-column: 4;
}

.tag-inline .inline-segmented {
  grid-column: 5;
}

.device-filter-block .device-strip {
  grid-column: 2;
}

.device-filter-block .mini-segmented {
  grid-column: 3;
}

.purpose-filter .inline-segmented {
  width: 128px;
  padding: 4px;
  margin: 0;
  background: rgba(226, 228, 240, 0.86);
}

.purpose-filter .segment,
.purpose-filter .mini-segmented button {
  min-height: 30px;
  border-radius: 9px;
  font-size: 12px;
}

.purpose-filter .chip-list {
  gap: 7px;
}

.purpose-icon-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.purpose-icon-button {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  padding: 0;
  filter: saturate(0.95);
}

.purpose-icon-button.is-active {
  border-color: var(--indigo);
  color: var(--indigo);
  background: rgba(255, 255, 255, 0.6);
  box-shadow: none;
}

.purpose-icon-divider {
  width: 1px;
  height: 34px;
  background: rgba(110, 112, 153, 0.22);
}

.purpose-filter .device-strip {
  gap: 8px;
}

.purpose-filter .mini-segmented {
  width: 108px;
  padding: 4px;
  margin: 0;
}

.filter-panel {
  border-radius: 22px;
  padding: 14px 18px;
  overflow: hidden;
}

.segmented,
.mini-segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(520px, 100%);
  margin: 0 auto 20px;
  padding: 7px;
  border-radius: 999px;
  background: rgba(222, 224, 241, 0.72);
}

.inline-segmented {
  width: min(360px, 100%);
  margin: 0;
}

.segment,
.mini-segmented button {
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font-weight: 750;
}

.segment.is-active,
.mini-segmented button.is-active {
  color: white;
  background: linear-gradient(135deg, #4b46db, #5e5ad9);
  box-shadow: 0 10px 22px rgba(75, 70, 219, 0.28);
}

.top-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}

.top-tab {
  min-width: 0;
  min-height: 58px;
  border: 0;
  border-bottom: 3px solid transparent;
  color: #8d8daf;
  background: transparent;
  font-size: 20px;
  font-weight: 800;
}

.label-short {
  display: none;
}

.top-tab.is-active {
  color: var(--text);
  border-color: var(--text);
}

.filter-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.tag-filter-row {
  grid-template-columns: 96px minmax(0, 1fr) 360px;
}

.filter-row:last-child {
  border-bottom: 0;
}

.row-label {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.2;
  font-weight: 760;
}

.chip-list,
.device-strip,
.card-tags,
.card-devices {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.card-body {
  min-width: 0;
}

.chip {
  min-height: 30px;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.64);
  font-size: 13px;
  font-weight: 780;
}

.chip.indigo,
.static-tag.indigo {
  color: var(--indigo);
}

.chip.orange,
.static-tag.orange {
  color: var(--orange);
}

.chip.brown,
.static-tag.brown {
  color: var(--brown);
}

.chip.violet,
.static-tag.violet {
  color: var(--violet);
}

.chip.is-selected.indigo,
.chip.is-selected.orange,
.chip.is-selected.brown,
.chip.is-selected.violet {
  color: white;
}

.chip.is-selected.indigo {
  background: var(--indigo);
}

.chip.is-selected.orange {
  background: var(--orange);
}

.chip.is-selected.brown {
  background: var(--brown);
}

.chip.is-selected.violet {
  background: var(--violet);
}

.device-button {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.95), 0 8px 18px rgba(44, 43, 87, 0.08);
}

.device-button img {
  width: 29px;
  height: 29px;
  object-fit: contain;
}

.device-button.is-selected {
  box-shadow: inset 0 0 0 2px var(--indigo), 0 12px 22px rgba(75, 70, 219, 0.22);
}

.device-fallback {
  display: none;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.device-filter-row {
  grid-template-columns: 96px minmax(0, 1fr) 220px;
}

.mini-segmented {
  width: 220px;
  margin: 0;
}

.filter-summary {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  padding-top: 12px;
  color: var(--muted);
  font-weight: 750;
}

.card-list {
  display: grid;
  gap: 14px;
  padding-bottom: 20px;
}

.review-card {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 96px;
  gap: 14px;
  align-items: stretch;
  min-height: 126px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(222, 225, 237, 0.9);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.76));
  box-shadow: 0 14px 36px rgba(52, 48, 86, 0.1);
}

.card-art {
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: white;
  font-size: 40px;
  overflow: hidden;
}

.card-art.indigo {
  background: linear-gradient(145deg, #292458, #5149d8);
}

.card-art.orange {
  background: linear-gradient(145deg, #e76e2d, #ffb071);
}

.card-art.violet {
  background: linear-gradient(145deg, #5d41bc, #9d82ff);
}

.card-art.brown {
  background: linear-gradient(145deg, #4b3b31, #806a58);
}

.card-title-row,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title-row h2,
.editor-section h2,
.device-summary h2,
.device-detail h2 {
  margin: 0;
}

.card-title-row h2 {
  font-size: 22px;
  line-height: 1.16;
  font-weight: 900;
}

.card-body p {
  margin: 10px 0 0;
  color: #4f547f;
  line-height: 1.42;
  overflow-wrap: anywhere;
}

.save-button {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
  background: rgba(245, 246, 252, 0.9);
}

.save-button.is-active {
  color: var(--indigo);
}

.static-tag {
  min-height: 25px;
  display: inline-flex;
  align-items: center;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.6);
}

.mini-device,
.more-device {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: rgba(241, 243, 250, 0.96);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.mini-device img {
  width: 19px;
  height: 19px;
  object-fit: contain;
}

.mini-device span {
  display: none;
}

.card-score {
  display: grid;
  align-content: center;
  justify-items: end;
  gap: 5px;
  color: var(--muted);
}

.card-score strong {
  color: var(--indigo);
  font-size: 32px;
  line-height: 1;
  letter-spacing: 0;
}

.review-card.orange .card-score strong {
  color: var(--orange);
}

.review-card.brown .card-score strong {
  color: var(--brown);
}

.review-card.violet .card-score strong {
  color: var(--violet);
}

.fab {
  position: fixed;
  right: max(24px, calc((100vw - 1120px) / 2 + 24px));
  bottom: 102px;
  width: 64px;
  height: 64px;
  border: 0;
  border-radius: 50%;
  color: white;
  background: linear-gradient(135deg, #ff7d31, #ff9d4f);
  font-size: 44px;
  line-height: 1;
  box-shadow: 0 18px 34px rgba(255, 125, 49, 0.36);
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  width: min(560px, calc(100% - 24px));
  min-height: 64px;
  border-radius: 22px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 18px 48px rgba(48, 45, 86, 0.16);
}

.bottom-nav button {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 5px;
  border: 0;
  border-radius: 16px;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
  font-weight: 800;
}

.nav-icon {
  position: relative;
  width: 18px;
  height: 18px;
  color: currentColor;
}

.nav-grid {
  display: grid;
  grid-template-columns: repeat(2, 5px);
  grid-template-rows: repeat(2, 5px);
  gap: 3px;
}

.nav-grid::before,
.nav-grid::after,
.nav-device::before,
.nav-device::after,
.nav-calendar::before,
.nav-calendar::after,
.nav-pill::before,
.nav-pill::after,
.nav-moon::before,
.nav-moon::after {
  content: "";
  display: block;
}

.nav-grid::before,
.nav-grid::after {
  width: 5px;
  height: 5px;
  border: 1.6px solid currentColor;
  border-radius: 2px;
  box-shadow: 8px 0 0 -1.6px transparent, 8px 0 0 0 currentColor, 0 8px 0 0 currentColor, 8px 8px 0 0 currentColor;
}

.nav-device::before {
  position: absolute;
  inset: 3px 2px 5px;
  border: 1.7px solid currentColor;
  border-radius: 5px;
}

.nav-device::after {
  position: absolute;
  left: 7px;
  bottom: 2px;
  width: 4px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.nav-calendar::before {
  position: absolute;
  inset: 3px 2px 2px;
  border: 1.6px solid currentColor;
  border-radius: 4px;
}

.nav-calendar::after {
  position: absolute;
  left: 5px;
  right: 5px;
  top: 8px;
  height: 1.6px;
  background: currentColor;
}

.nav-pill::before {
  position: absolute;
  left: 2px;
  top: 5px;
  width: 14px;
  height: 8px;
  border: 1.7px solid currentColor;
  border-radius: 999px;
  transform: rotate(-28deg);
}

.nav-pill::after {
  position: absolute;
  left: 8px;
  top: 5px;
  width: 1.7px;
  height: 8px;
  background: currentColor;
  transform: rotate(-28deg);
}

.nav-moon::before {
  position: absolute;
  inset: 2px 3px 2px 2px;
  border: 1.8px solid currentColor;
  border-radius: 50%;
}

.nav-moon::after {
  position: absolute;
  inset: 0 0 0 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.82);
}

.nav-book::before,
.nav-book::after,
.nav-doc::before,
.nav-doc::after,
.nav-flag::before,
.nav-flag::after,
.nav-brain::before,
.nav-brain::after,
.nav-link::before,
.nav-link::after {
  content: "";
  position: absolute;
  display: block;
}

.nav-book::before {
  inset: 2px 1px 2px;
  border: 1.7px solid currentColor;
  border-radius: 3px;
}

.nav-book::after {
  top: 3px;
  bottom: 3px;
  left: 50%;
  width: 1.5px;
  background: currentColor;
  transform: translateX(-50%);
}

.nav-doc::before {
  inset: 1px 4px 1px 3px;
  border: 1.7px solid currentColor;
  border-radius: 3px;
}

.nav-doc::after {
  right: 4px;
  top: 1px;
  width: 6px;
  height: 6px;
  border-left: 1.7px solid currentColor;
  border-bottom: 1.7px solid currentColor;
  background: rgba(255, 255, 255, 0.82);
}

.nav-flag::before {
  left: 4px;
  top: 2px;
  bottom: 2px;
  width: 1.7px;
  background: currentColor;
}

.nav-flag::after {
  left: 6px;
  top: 3px;
  width: 10px;
  height: 8px;
  border: 1.7px solid currentColor;
  border-left: 0;
  border-radius: 1px 4px 4px 1px;
}

.nav-brain::before {
  inset: 1px 2px 1px;
  border: 1.8px solid currentColor;
  border-radius: 9px 9px 7px 7px;
}

.nav-brain::after {
  top: 3px;
  bottom: 3px;
  left: 50%;
  width: 1.5px;
  background: currentColor;
  transform: translateX(-50%);
}

.nav-link::before,
.nav-link::after {
  top: 6px;
  width: 10px;
  height: 6px;
  border: 1.8px solid currentColor;
  border-radius: 999px;
}

.nav-link::before {
  left: 1px;
  transform: rotate(-18deg);
}

.nav-link::after {
  right: 1px;
  transform: rotate(-18deg);
}

.bottom-nav button.is-active {
  color: var(--indigo);
  background: rgba(75, 70, 219, 0.09);
}

.bottom-nav button:disabled {
  cursor: not-allowed;
  opacity: 0.44;
}

.shell:has(.phase-screen) {
  width: 100%;
  min-height: 100vh;
  padding: 0 0 104px;
  background: #f7f8fb;
}

.shell:has(.phase-screen) .screen {
  display: block;
}

.phase-screen {
  min-height: 100vh;
  color: #f8f8ff;
  padding: 28px 18px 104px;
}

.phase-page {
  width: min(920px, 100%);
  margin: 0 auto;
  text-align: left;
}

.phase-page h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.12;
  font-weight: 900;
}

.phase-kicker {
  margin: 6px 0 0;
  color: #9db0d6;
  font-size: 13px;
  line-height: 1.2;
  letter-spacing: 0.12em;
}

.phase-content-tabs {
  display: inline-flex;
  justify-content: flex-start;
  gap: 8px;
  margin: 18px 0 0;
  padding: 4px;
  border: 1px solid rgba(101, 116, 158, 0.28);
  border-radius: 12px;
  background: rgba(10, 14, 30, 0.62);
}

.phase-content-tabs button {
  min-width: 86px;
  min-height: 30px;
  border: 0;
  border-radius: 8px;
  color: rgba(214, 221, 243, 0.82);
  background: transparent;
  font-size: 12px;
  font-weight: 760;
  box-shadow: none;
}

.phase-content-tabs button.is-active {
  color: white;
  background: #9f3ff1;
  box-shadow: 0 8px 18px rgba(163, 65, 242, 0.24);
}

.phase-add-button {
  width: 100%;
  min-height: 42px;
  margin: 28px 0 0;
  border: 2px dashed rgba(159, 70, 218, 0.64);
  border-radius: 14px;
  color: #cb6cff;
  background: rgba(18, 22, 42, 0.5);
  font-size: 14px;
  font-weight: 640;
}

.phase-empty {
  display: grid;
  justify-items: center;
  gap: 7px;
  margin-top: 42px;
  color: rgba(153, 163, 199, 0.68);
}

.phase-empty-icon {
  font-size: 24px;
  line-height: 1;
}

.phase-empty p,
.phase-empty span {
  margin: 0;
  font-size: 13px;
  line-height: 1.28;
}

.phase-empty span {
  color: rgba(139, 149, 184, 0.66);
}

.cycle-panel {
  margin: 22px auto 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: #e9ecff;
  background: transparent;
  box-shadow: none;
  text-align: left;
}

.technique-chip-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 6px;
  margin: 12px 0 14px;
}

.technique-chip-row button {
  min-height: 25px;
  border: 1px solid rgba(142, 156, 201, 0.36);
  border-radius: 8px;
  padding: 0 10px;
  color: #b8c2e0;
  background: rgba(18, 24, 46, 0.72);
  font-size: 11px;
  font-weight: 680;
}

.technique-chip-row button.is-active {
  border-color: #f5b93f;
  color: #ffe2a1;
  background: rgba(245, 185, 63, 0.12);
}

.cycle-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 0;
}

.cycle-panel-head h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.cycle-panel-head p {
  margin: 4px 0 0;
  color: rgba(172, 183, 214, 0.72);
  font-size: 12px;
  line-height: 1.4;
}

.cycle-panel-head button {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(134, 149, 194, 0.4);
  border-radius: 10px;
  color: #c569ff;
  background: rgba(18, 24, 46, 0.72);
  font-size: 22px;
  line-height: 1;
}

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

.cycle-card {
  min-height: 112px;
  padding: 12px 14px;
  border: 1px solid rgba(123, 139, 185, 0.24);
  border-radius: 10px;
  background: rgba(15, 20, 40, 0.78);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.cycle-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.cycle-card-button {
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  text-align: left;
  color: inherit;
  background: transparent;
}

.cycle-card-button:hover h3,
.notes-row[data-action]:hover h3 {
  color: #d792ff;
}

.cycle-card-title span {
  color: #c7ced9;
  font-size: 15px;
}

.cycle-card h3 {
  margin: 0;
  color: #f8f9ff;
  font-size: 14px;
  line-height: 1.3;
}

.cycle-card p {
  margin: 4px 0 0;
  color: rgba(212, 219, 240, 0.82);
  font-size: 11px;
  line-height: 1.45;
}

.cycle-card .advice-timing {
  margin-top: 10px;
  color: #8b7cff;
  font-weight: 760;
}

.cycle-stars .star-on {
  color: #f4b000;
  letter-spacing: 0;
}

.cycle-stars .star-off {
  color: #cfd4dd;
  letter-spacing: 0;
}

.cycle-category-add {
  width: 100%;
  min-height: 36px;
  margin-top: 12px;
  border: 1px dashed rgba(163, 75, 221, 0.55);
  border-radius: 10px;
  color: #cb6cff;
  background: rgba(18, 22, 42, 0.45);
  font-size: 14px;
  font-weight: 760;
}

.learning-list,
.notes-page {
  margin-top: 22px;
}

.learning-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.learning-list-head h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.learning-list-head button,
.write-button {
  min-height: 34px;
  border: 0;
  border-radius: 10px;
  padding: 0 14px;
  color: white;
  background: #9f3ff1;
  font-size: 13px;
  font-weight: 760;
}

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

.video-card {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(123, 139, 185, 0.24);
  border-radius: 12px;
  background: rgba(15, 20, 40, 0.78);
}

.video-thumb {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  border-radius: 9px;
  color: white;
  background: linear-gradient(135deg, #382061, #1165c8);
  font-size: 18px;
}

.video-card h3 {
  margin: 0;
  color: #f8f9ff;
  font-size: 14px;
  line-height: 1.35;
}

.video-card p {
  margin: 5px 0 8px;
  color: rgba(172, 183, 214, 0.72);
  font-size: 11px;
}

.notes-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px auto;
  gap: 8px;
  margin-bottom: 12px;
}

.notes-toolbar input {
  min-height: 42px;
  border: 1px solid rgba(123, 139, 185, 0.24);
  border-radius: 12px;
  padding: 0 14px;
  color: #e9ecff;
  background: rgba(15, 20, 40, 0.78);
  font-size: 14px;
}

.notes-toolbar button:not(.write-button) {
  border: 1px solid rgba(123, 139, 185, 0.24);
  border-radius: 12px;
  color: #b8c2e0;
  background: rgba(15, 20, 40, 0.78);
}

.notes-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.notes-tags button,
.more-tags {
  min-height: 25px;
  border: 1px solid rgba(142, 156, 201, 0.28);
  border-radius: 7px;
  padding: 0 9px;
  color: #b8c2e0;
  background: rgba(18, 24, 46, 0.68);
  font-size: 11px;
}

.notes-tags button.is-active {
  border-color: #9f3ff1;
  color: white;
  background: #9f3ff1;
}

.more-tags {
  margin-top: 8px;
  border: 0;
  color: #cb6cff;
  background: transparent;
  padding: 0;
}

.notes-table {
  margin-top: 16px;
  border: 1px solid rgba(123, 139, 185, 0.24);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(15, 20, 40, 0.72);
}

.notes-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 132px 42px;
  gap: 12px;
  align-items: center;
  min-height: 72px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(123, 139, 185, 0.16);
  color: rgba(226, 231, 250, 0.86);
}

.notes-row[data-action] {
  cursor: pointer;
}

.notes-row:last-child {
  border-bottom: 0;
}

.notes-head {
  min-height: 44px;
  color: rgba(172, 183, 214, 0.78);
  background: rgba(255, 255, 255, 0.03);
  font-size: 12px;
}

.notes-row h3 {
  margin: 0 0 7px;
  color: #f8f9ff;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 650;
}

.notes-row time,
.notes-row > span {
  font-size: 12px;
  color: rgba(190, 200, 226, 0.8);
}

.note-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.note-tag-row span {
  min-height: 20px;
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  padding: 0 7px;
  color: #d67cff;
  background: rgba(159, 63, 241, 0.12);
  font-size: 10px;
}

.notes-pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
}

.notes-pagination button {
  min-width: 30px;
  min-height: 30px;
  border: 1px solid rgba(142, 156, 201, 0.32);
  border-radius: 8px;
  color: #b8c2e0;
  background: rgba(18, 24, 46, 0.68);
  font-size: 12px;
}

.notes-pagination button.is-active {
  color: white;
  border-color: #9f3ff1;
  background: #9f3ff1;
}

.phase-detail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(3, 5, 12, 0.62);
}

.phase-detail {
  position: relative;
  width: min(620px, 100%);
  border: 1px solid rgba(123, 139, 185, 0.34);
  border-radius: 16px;
  padding: 24px;
  color: #e9ecff;
  background: #11162a;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.46);
}

.phase-detail-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(142, 156, 201, 0.32);
  border-radius: 10px;
  color: #b8c2e0;
  background: rgba(18, 24, 46, 0.72);
}

.phase-detail h2 {
  margin: 0 42px 14px 0;
  font-size: 24px;
  line-height: 1.35;
}

.phase-detail p {
  margin: 12px 0 0;
  color: rgba(226, 231, 250, 0.88);
  font-size: 15px;
  line-height: 1.65;
}

.phase-detail .detail-meta {
  margin: 0 0 8px;
  color: rgba(172, 183, 214, 0.72);
  font-size: 12px;
}

.empty-state {
  display: grid;
  justify-items: start;
  gap: 8px;
  border-radius: 26px;
  padding: 26px;
}

.primary-button,
.ghost-button,
.small-button {
  min-height: 42px;
  border-radius: 999px;
  padding: 0 18px;
  font-weight: 820;
}

.primary-button {
  border: 0;
  color: white;
  background: linear-gradient(135deg, #4b46db, #635fec);
}

.ghost-button,
.small-button {
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.62);
}

.editor-toolbar,
.commit-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-radius: 24px;
  padding: 12px 14px;
}

.autosave {
  color: var(--green);
  font-weight: 800;
}

.create-screen {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.create-topbar,
.create-footer {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.create-topbar {
  border-radius: 16px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: var(--shadow-tight);
}

.create-title-field {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.create-title-field span,
.create-section-head span,
.create-footer span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.create-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--green);
  font-size: 13px;
  font-weight: 820;
}

.create-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.72fr);
  gap: 12px;
}

.create-section {
  min-width: 0;
  border: 1px solid rgba(110, 112, 153, 0.14);
  border-radius: 16px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: 0 8px 20px rgba(45, 43, 82, 0.06);
}

.create-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.create-section-head h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  font-weight: 850;
}

.purpose-row {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 9px 0;
  border-top: 1px solid rgba(110, 112, 153, 0.12);
}

.purpose-row:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.purpose-row strong {
  color: var(--text);
  font-size: 13px;
  line-height: 30px;
}

.create-device-strip {
  gap: 8px;
}

.record-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.create-app-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.round-action {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(110, 112, 153, 0.18);
  border-radius: 50%;
  color: var(--text);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 8px 18px rgba(45, 43, 82, 0.08);
  font-size: 13px;
  font-weight: 850;
}

.round-action:hover {
  background: rgba(236, 235, 255, 0.8);
}

.inventory-action {
  color: var(--indigo);
}

.inventory-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(110, 112, 153, 0.2);
  border-radius: 10px;
  color: var(--indigo);
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 8px 18px rgba(45, 43, 82, 0.08);
}

.inventory-button:hover {
  background: var(--indigo-soft);
}

.inventory-button-icon {
  position: relative;
  width: 17px;
  height: 15px;
  border: 1.8px solid currentColor;
  border-radius: 4px;
}

.inventory-button-icon::before,
.inventory-button-icon::after {
  content: "";
  position: absolute;
  display: block;
}

.inventory-button-icon::before {
  left: 3px;
  right: 3px;
  top: -5px;
  height: 5px;
  border: 1.8px solid currentColor;
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
}

.inventory-button-icon::after {
  left: 4px;
  right: 4px;
  top: 5px;
  height: 1.8px;
  border-radius: 999px;
  background: currentColor;
}

.compact-button {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 12px;
  white-space: nowrap;
}

.create-screen .title-input {
  min-height: 38px;
  border-radius: 12px;
  padding: 7px 10px;
  font-size: 17px;
  font-weight: 850;
  background: rgba(255, 255, 255, 0.74);
}

.create-screen .small-button {
  min-height: 32px;
  border-radius: 10px;
  padding: 0 10px;
  font-size: 12px;
}

.create-compact-picker {
  display: grid;
  gap: 0;
  border-radius: 16px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: var(--shadow-tight);
}

.compact-picker-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  border-bottom: 1px solid rgba(110, 112, 153, 0.14);
}

.compact-picker-row:last-child {
  border-bottom: 0;
}

.compact-label,
.compact-count {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.compact-count {
  white-space: nowrap;
}

.compact-chip-groups {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.compact-chip-groups::-webkit-scrollbar {
  display: none;
}

.compact-chip-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.compact-chip-group strong {
  color: var(--text);
  font-size: 12px;
  white-space: nowrap;
}

.segment-section .section-heading {
  align-items: flex-start;
  margin-bottom: 10px;
}

.segment-table-wrap {
  overflow: auto;
  border: 1px solid rgba(110, 112, 153, 0.18);
  border-radius: 14px;
  padding: 0;
  background: rgba(255, 255, 255, 0.72);
}

.segment-table {
  width: 100%;
  min-width: 620px;
  border-collapse: separate;
  border-spacing: 0;
}

.segment-table th,
.segment-table td {
  height: 44px;
  border-right: 1px solid rgba(110, 112, 153, 0.16);
  border-bottom: 1px solid rgba(110, 112, 153, 0.16);
  padding: 0 10px;
  text-align: left;
  vertical-align: middle;
}

.segment-table tr:last-child th,
.segment-table tr:last-child td {
  border-bottom: 0;
}

.segment-table th:last-child,
.segment-table td:last-child {
  border-right: 0;
}

.segment-table thead th {
  color: var(--text);
  background: rgba(237, 239, 248, 0.9);
  font-size: 13px;
  font-weight: 850;
}

.segment-table th:first-child {
  width: 132px;
  color: var(--muted);
  background: rgba(248, 249, 253, 0.95);
  font-size: 13px;
  font-weight: 820;
}

.segment-table input,
.segment-table .cell-input {
  min-height: 32px;
  border: 0;
  border-radius: 8px;
  padding: 0 8px;
  background: transparent;
  font-size: 13px;
  font-weight: 720;
}

.segment-table input:focus {
  background: white;
  box-shadow: inset 0 0 0 1px rgba(75, 70, 219, 0.24);
}

.table-head-edit,
.table-row-label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.table-head-edit input {
  min-width: 0;
}

.table-row-label {
  justify-content: space-between;
}

.table-row-label span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-remove {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: rgba(232, 234, 244, 0.9);
  font-size: 14px;
  line-height: 1;
  font-weight: 850;
}

.table-remove:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.table-minute {
  gap: 4px;
}

.table-minute input {
  width: 64px;
}

.compact-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.compact-field .minute-input {
  width: 112px;
}

.compact-field input {
  min-height: 34px;
}

.create-footer {
  border-top: 1px solid rgba(110, 112, 153, 0.14);
  padding-top: 12px;
}

.editor-grid,
.device-dashboard {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.editor-section,
.device-summary,
.device-summary-card,
.device-detail {
  border-radius: 26px;
  padding: 20px;
}

.wide {
  grid-column: 1 / -1;
}

.field-label,
.editable-stack label,
.medication-form label {
  display: block;
  margin: 0 0 8px;
  color: var(--muted);
  font-weight: 800;
}

.title-input,
.editor-section input,
.editor-section textarea,
.editable-stack input,
.editable-stack textarea,
.chat-box input,
.medication-form input,
.medication-form select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.72);
}

.title-input {
  font-size: 28px;
  font-weight: 850;
}

.purpose-block {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.helper-text {
  color: var(--muted);
  line-height: 1.5;
}

.minute-input {
  display: flex;
  align-items: center;
  gap: 8px;
}

.minute-input span {
  color: var(--muted);
  font-weight: 800;
}

.gauge-list {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.gauge-row {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) 38px;
  align-items: center;
  gap: 10px;
}

.feedback-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.feedback-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}

.level-button {
  border: 0;
  border-radius: 16px;
  color: white;
  font-weight: 900;
}

.level-1 {
  background: #7c84a8;
}

.level-2 {
  background: var(--indigo);
}

.level-3 {
  background: var(--orange);
}

.level-4 {
  background: #e04747;
}

.device-tabs {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  border-radius: 26px;
  padding: 14px;
}

.large-device {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.large-device .device-button {
  width: 68px;
  height: 68px;
  pointer-events: none;
}

.editable-stack {
  display: grid;
  gap: 10px;
}

.todo-list {
  margin: 16px 0 0;
  padding-left: 20px;
  color: #555882;
}

.link-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 44px;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.58);
}

.chat-box {
  display: grid;
  gap: 12px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(14, 18, 49, 0.22);
}

.modal {
  width: min(440px, 100%);
  border-radius: 28px;
  padding: 24px;
}

.modal.large {
  width: min(760px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.modal.large::-webkit-scrollbar {
  display: none;
}

.modal h2 {
  margin: 0 0 8px;
}

.create-confirm-modal {
  width: min(360px, calc(100vw - 36px));
  border-radius: 18px;
  padding: 18px;
}

.create-confirm-modal h2 {
  margin: 0 0 8px;
  font-size: 22px;
  line-height: 1.22;
  letter-spacing: 0;
}

.create-confirm-modal p {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  font-weight: 650;
}

.create-confirm-modal .modal-actions {
  gap: 8px;
  margin-top: 16px;
}

.create-confirm-modal .primary-button,
.create-confirm-modal .ghost-button {
  min-height: 36px;
  padding: 0 16px;
  font-size: 14px;
}

.supplement-inventory-modal .section-heading {
  align-items: flex-start;
}

.modal.large.supplement-inventory-modal {
  width: calc(100vw - 28px);
  height: calc(100dvh - 28px);
  max-height: calc(100dvh - 28px);
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.supplements-empty {
  min-height: calc(100vh - 220px);
}

.supplement-dashboard {
  display: grid;
  gap: 10px;
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  color: rgba(220, 230, 255, 0.92);
}

.supplement-section {
  overflow: hidden;
  border: 1px solid rgba(100, 130, 255, 0.12);
  border-radius: 16px;
  padding: 12px;
  background: rgba(10, 14, 42, 0.96);
}

.supp-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.supp-section-head h2 {
  margin: 0;
  color: #eef2ff;
  font-size: 17px;
  line-height: 1.2;
}

.supp-section-head span {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(140, 120, 220, 0.32);
  border-radius: 999px;
  padding: 0 10px;
  color: #c4a0ff;
  background: rgba(140, 100, 220, 0.18);
  font-size: 11px;
  font-weight: 800;
}

.supp-section-head.compact {
  margin-bottom: 5px;
}

.supp-timeline-scroll,
.supp-chain-scroll {
  overflow-x: auto;
  scrollbar-width: none;
}

.supp-timeline-scroll::-webkit-scrollbar,
.supp-chain-scroll::-webkit-scrollbar {
  display: none;
}

.supp-timeline-grid {
  position: relative;
  min-width: 620px;
  overflow: hidden;
  border: 1px solid rgba(80, 100, 180, 0.14);
  border-radius: 10px;
  background: rgba(15, 22, 55, 0.72);
}

.supp-time-head,
.supp-tl-row {
  display: grid;
  grid-template-columns: 86px repeat(5, minmax(90px, 1fr));
  min-height: 28px;
  border-bottom: 1px solid rgba(80, 100, 180, 0.12);
}

.supp-time-head {
  align-items: center;
  color: rgba(140, 165, 255, 0.46);
  font-size: 10px;
}

.supp-tl-row:last-child {
  border-bottom: 0;
}

.supp-tl-label {
  display: flex;
  align-items: center;
  min-width: 0;
  padding-left: 10px;
  color: rgba(190, 205, 255, 0.78);
  font-size: 12px;
  white-space: nowrap;
}

.supp-tl-track {
  position: relative;
  grid-column: 2 / -1;
  min-height: 28px;
}

.supp-tl-bar {
  position: absolute;
  top: 7px;
  height: 15px;
  border-radius: 5px;
  opacity: 0.78;
}

.supp-tl-bar.green {
  background: rgba(80, 200, 140, 0.5);
}

.supp-tl-bar.purple {
  background: rgba(140, 120, 220, 0.54);
}

.supp-tl-bar.blue {
  background: rgba(80, 140, 255, 0.5);
}

.supp-tl-diamond {
  position: absolute;
  top: 5px;
  width: 12px;
  height: 12px;
  border: 1px solid rgba(255, 180, 50, 0.9);
  border-radius: 3px;
  background: rgba(255, 200, 80, 0.86);
  transform: rotate(45deg);
  z-index: 4;
}

.supp-now-line {
  position: absolute;
  top: 18px;
  bottom: 0;
  left: 34%;
  width: 2px;
  background: rgba(255, 70, 70, 0.62);
  z-index: 5;
}

.supp-routine-line {
  position: absolute;
  top: 0;
  bottom: 0;
  border-left: 1.5px dashed rgba(100, 170, 255, 0.35);
  z-index: 4;
}

.supp-routine-line.one {
  left: 42%;
}

.supp-routine-line.two {
  left: 74%;
}

.supp-routine-line span {
  position: absolute;
  top: 2px;
  left: -18px;
  color: rgba(100, 170, 255, 0.72);
  font-size: 9px;
  white-space: nowrap;
}

.supp-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 7px;
  font-size: 10px;
  color: rgba(160, 180, 255, 0.5);
}

.supp-legend span::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 4px;
  border-radius: 2px;
  vertical-align: -1px;
  background: rgba(140, 150, 180, 0.32);
}

.supp-legend .done::before {
  background: rgba(80, 200, 140, 0.62);
}

.supp-legend .planned::before {
  background: rgba(140, 120, 220, 0.62);
}

.supp-legend .chain::before {
  transform: rotate(45deg);
  background: rgba(255, 200, 80, 0.86);
}

@keyframes cooltimePulse {
  0%, 100% { box-shadow: 0 0 3px rgba(255, 80, 80, 0.3); }
  50% { box-shadow: 0 0 12px rgba(255, 80, 80, 0.7); }
}

@keyframes cooltimeSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.cooltime-board {
  overflow: hidden;
  border: 1px solid rgba(100, 130, 255, 0.08);
  border-radius: 20px;
  padding: 10px 8px;
  background: rgba(10, 14, 42, 1);
}

.cooltime-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
  padding: 0 4px;
}

.cooltime-head span {
  color: rgba(140, 165, 255, 0.35);
  font-size: 8px;
}

.cooltime-head button {
  border: 1px solid rgba(100, 170, 255, 0.12);
  border-radius: 6px;
  padding: 4px 10px;
  color: rgba(100, 170, 255, 0.5);
  background: rgba(100, 170, 255, 0.06);
  font-size: 9px;
  font-weight: 600;
}

.cooltime-row {
  display: flex;
  justify-content: flex-start;
  gap: 5px;
  overflow-x: auto;
  padding: 2px 0;
  scrollbar-width: none;
}

.cooltime-row::-webkit-scrollbar {
  display: none;
}

.cooltime-row-second {
  padding-left: 4px;
}

.cooltime-cell {
  flex: 0 0 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  border: 0;
  background: transparent;
  color: rgba(140, 150, 170, 0.5);
  text-align: center;
}

.cooltime-ring {
  position: relative;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2.5px solid rgba(140, 150, 170, 0.1);
  border-radius: 50%;
}

.cooltime-ring svg,
.cooltime-spinner {
  position: absolute;
  inset: 0;
}

.cooltime-spinner {
  width: 46px;
  height: 46px;
  border: 2px solid transparent;
  border-radius: 50%;
  animation: cooltimeSpin 2s linear infinite;
}

.cooltime-ring b {
  position: relative;
  z-index: 1;
  max-width: 38px;
  overflow: hidden;
  color: currentColor;
  font-size: 7px;
  font-weight: 650;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cooltime-cell small {
  max-width: 56px;
  overflow: hidden;
  color: currentColor;
  font-size: 6.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cooltime-cell.hot {
  color: rgba(255, 100, 100, 0.9);
}

.cooltime-cell.hot .cooltime-ring {
  border-color: rgba(255, 80, 80, 0.5);
  background: rgba(255, 80, 80, 0.06);
  animation: cooltimePulse 1s ease-in-out infinite;
}

.cooltime-cell.hot .cooltime-spinner {
  border-top-color: rgba(255, 80, 80, 0.7);
}

.cooltime-cell.warn {
  color: rgba(255, 100, 100, 0.72);
}

.cooltime-cell.warn .cooltime-ring {
  border-color: rgba(255, 80, 80, 0.25);
}

.cooltime-cell.warn .cooltime-spinner {
  border-top-color: rgba(255, 80, 80, 0.5);
}

.cooltime-cell.cool {
  color: rgba(80, 140, 255, 0.78);
}

.cooltime-cell.cool .cooltime-ring {
  border-color: rgba(80, 140, 255, 0.25);
}

.cooltime-cell.idle {
  color: rgba(140, 150, 170, 0.35);
}

.cooltime-cell.idle .cooltime-ring {
  opacity: 0.5;
}

.cooltime-cell.rule-blocked .cooltime-ring {
  border-color: rgba(255, 80, 80, 0.5);
}

.cooltime-expand {
  display: flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  margin: 2px auto 0;
  border: 1px solid rgba(100, 130, 255, 0.08);
  border-radius: 6px;
  padding: 3px 12px;
  color: rgba(140, 165, 255, 0.4);
  background: rgba(100, 130, 255, 0.04);
  font-size: 8px;
}

.supp-chain-scroll {
  display: grid;
  gap: 9px;
}

.supp-chain-card {
  min-width: 620px;
  border: 1px solid rgba(100, 130, 255, 0.1);
  border-radius: 14px;
  padding: 10px;
  background: rgba(20, 28, 65, 0.5);
}

.supp-chain-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.supp-chain-card-head strong {
  color: #eef2ff;
}

.supp-chain-card-head span {
  color: rgba(160, 180, 255, 0.5);
  font-size: 11px;
}

.supp-chain-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.supp-chain-node {
  flex: 0 0 108px;
  text-align: center;
}

.supp-chain-node button {
  width: 82px;
  height: 82px;
  border: 2px solid rgba(100, 80, 160, 0.45);
  border-radius: 20px;
  color: rgba(180, 185, 210, 0.88);
  background: rgba(80, 60, 120, 0.2);
  font-size: 30px;
}

.supp-chain-node.due button {
  border-color: rgba(255, 180, 80, 0.48);
}

.supp-chain-node.taken button {
  border-color: rgba(80, 200, 140, 0.48);
}

.supp-chain-node em,
.supp-chain-node strong,
.supp-chain-node small {
  display: block;
}

.supp-chain-node em {
  width: max-content;
  margin: 6px auto 2px;
  border-radius: 8px;
  padding: 2px 8px;
  color: #66cc88;
  background: rgba(80, 200, 120, 0.15);
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
}

.supp-chain-node strong {
  color: #eef2ff;
  font-size: 13px;
}

.supp-chain-node small {
  color: rgba(180, 190, 220, 0.64);
  font-size: 12px;
}

.supp-chain-connector {
  flex: 0 0 116px;
  display: flex;
  align-items: center;
  gap: 0;
  margin-top: 36px;
}

.supp-chain-connector i {
  flex: 1;
  height: 2px;
  background: rgba(255, 255, 255, 0.12);
}

.supp-chain-connector span {
  border-radius: 8px;
  padding: 4px 9px;
  color: #66cc88;
  background: rgba(80, 200, 120, 0.12);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.supp-empty-line {
  border: 1px dashed rgba(100, 130, 255, 0.16);
  border-radius: 12px;
  padding: 14px;
  color: rgba(160, 180, 255, 0.45);
}

.supp-residual-list {
  display: grid;
  gap: 10px;
}

.supp-residual-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 60px;
  align-items: center;
  gap: 10px;
}

.supp-residual-row > span {
  color: rgba(220, 230, 255, 0.82);
  font-size: 15px;
}

.supp-residual-track {
  position: relative;
  min-height: 34px;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.supp-residual-track i {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 8px;
}

.supp-residual-row.blue .supp-residual-track i {
  background: rgba(95, 130, 205, 0.92);
}

.supp-residual-row.green .supp-residual-track i {
  background: rgba(90, 200, 130, 0.92);
}

.supp-residual-row.orange .supp-residual-track i {
  background: rgba(205, 126, 88, 0.92);
}

.supp-residual-track b {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  height: 34px;
  padding: 0 12px;
  color: #f3f5ff;
  font-size: 12px;
}

.supp-residual-row em {
  color: rgba(160, 180, 255, 0.62);
  font-size: 11px;
  font-style: normal;
  text-align: right;
}

.supplement-chain-modal {
  max-width: min(760px, calc(100vw - 24px));
}

.chain-settings-shell {
  display: grid;
  gap: 12px;
  color: rgba(220, 230, 255, 0.92);
}

.chain-settings-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.chain-settings-top h2 {
  margin: 0;
  color: rgba(255, 230, 150, 0.94);
}

.chain-setting-card {
  border: 1px solid rgba(100, 130, 255, 0.12);
  border-radius: 16px;
  padding: 14px;
  background: rgba(20, 28, 65, 0.58);
}

.chain-card-label {
  margin-bottom: 10px;
  color: rgba(160, 180, 255, 0.52);
  font-size: 12px;
}

.chain-anchor-button {
  width: 100%;
  min-height: 72px;
  display: grid;
  gap: 4px;
  border: 1px solid rgba(100, 130, 255, 0.14);
  border-radius: 14px;
  padding: 12px 16px;
  color: #eef2ff;
  background: rgba(30, 40, 90, 0.58);
  text-align: left;
}

.chain-anchor-button span {
  font-size: 18px;
  font-weight: 850;
}

.chain-anchor-button b {
  color: rgba(160, 180, 255, 0.48);
  font-size: 12px;
}

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

.chain-anchor-options button {
  min-height: 40px;
  border: 1px solid rgba(100, 130, 255, 0.12);
  border-radius: 999px;
  color: rgba(160, 180, 255, 0.72);
  background: rgba(30, 40, 90, 0.52);
  font-weight: 850;
}

.chain-anchor-options button.is-active {
  border-color: rgba(180, 140, 255, 0.5);
  color: #d8c8ff;
  background: rgba(140, 100, 220, 0.22);
}

.chain-name-field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: rgba(160, 180, 255, 0.55);
  font-size: 12px;
}

.chain-name-field input {
  border: 1px solid rgba(100, 130, 255, 0.14);
  border-radius: 12px;
  padding: 12px;
  color: #eef2ff;
  background: rgba(12, 16, 42, 0.9);
}

.chain-step-editor {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  scrollbar-width: none;
}

.chain-step-editor::-webkit-scrollbar {
  display: none;
}

.chain-step-node {
  flex: 0 0 96px;
  text-align: center;
}

.chain-node-box {
  width: 78px;
  height: 78px;
  border: 2px solid rgba(100, 80, 160, 0.45);
  border-radius: 20px;
  color: rgba(180, 185, 210, 0.88);
  background: rgba(80, 60, 120, 0.2);
  font-size: 28px;
}

.chain-step-node strong,
.chain-step-node small {
  display: block;
}

.chain-step-node strong {
  color: #eef2ff;
  font-size: 12px;
}

.chain-step-node small {
  color: rgba(180, 190, 220, 0.64);
  font-size: 11px;
}

.chain-step-field {
  display: grid;
  gap: 4px;
  margin-top: 7px;
  color: rgba(170, 184, 226, 0.72);
  font-size: 10px;
  font-weight: 760;
  text-align: left;
}

.chain-step-field select,
.chain-step-field input,
.rule-grid select {
  width: 100%;
  min-width: 0;
  min-height: 30px;
  border: 1px solid rgba(120, 126, 190, 0.24);
  border-radius: 9px;
  padding: 0 8px;
  color: rgba(235, 240, 255, 0.92);
  background: rgba(16, 22, 54, 0.72);
  font: inherit;
}

.chain-rule-mini {
  margin-top: 5px;
  border: 0;
  color: rgba(160, 180, 255, 0.52);
  background: transparent;
  font-size: 11px;
}

.chain-reminder-actions {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-top: 4px;
}

.chain-reminder-actions button {
  border: 1px solid rgba(100, 130, 255, 0.1);
  border-radius: 6px;
  padding: 3px 6px;
  color: rgba(160, 180, 255, 0.5);
  background: rgba(12, 16, 42, 0.68);
  font-size: 9px;
  font-weight: 800;
}

.chain-delay-editor {
  flex: 0 0 112px;
  display: flex;
  align-items: center;
  gap: 0;
  margin-top: 34px;
  border: 0;
  background: transparent;
}

.chain-delay-editor i {
  flex: 1;
  height: 2px;
  background: rgba(255, 255, 255, 0.12);
}

.chain-delay-editor span {
  border-radius: 8px;
  padding: 4px 9px;
  color: #66cc88;
  background: rgba(80, 200, 120, 0.12);
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}

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

.supplement-chain-modal {
  max-width: min(600px, calc(100vw - 24px));
  padding: 28px;
  background: #14142a;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
}

.chain-reference-shell {
  gap: 24px;
}

.chain-reference-shell .chain-settings-top {
  margin-bottom: -4px;
}

.chain-reference-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 28px;
  background: #14142a;
}

.chain-reference-card .chain-card-label {
  margin-bottom: 16px;
  color: #888;
  font-size: 13px;
}

.chain-title {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  font-size: 22px;
  font-weight: 700;
}

.chain-title .highlight {
  color: #cc88ff;
}

.chain-title .normal {
  color: #fff;
}

.time-input-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
}

.time-number {
  width: 80px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 14px 20px;
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  font-size: 32px;
  font-weight: 700;
  text-align: center;
}

.time-chip {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 8px 18px;
  color: #888;
  background: transparent;
  font-size: 14px;
}

.time-chip.active {
  border-color: rgba(80, 80, 200, 0.4);
  color: #aabbff;
  background: rgba(80, 80, 200, 0.2);
}

.chain-desc {
  margin-top: 12px;
  color: #777;
  font-size: 14px;
}

.supplement-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  overflow-x: auto;
  margin-top: 20px;
  padding-bottom: 10px;
  scrollbar-width: none;
}

.supplement-row::-webkit-scrollbar {
  display: none;
}

.supplement-item {
  flex: 0 0 auto;
  text-align: center;
}

.supplement-box {
  position: relative;
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 8px;
  border: 2px solid rgba(100, 80, 160, 0.4);
  border-radius: 18px;
  color: #aaa;
  background: rgba(80, 60, 120, 0.2);
  font-size: 28px;
}

.supplement-box .plus {
  color: #888;
  font-size: 24px;
}

.supplement-name {
  color: #ccc;
  font-size: 12px;
  font-weight: 500;
}

.supplement-dose {
  color: #888;
  font-size: 11px;
}

.time-badge {
  display: inline-block;
  margin-top: 4px;
  border: 0;
  border-radius: 8px;
  padding: 2px 8px;
  color: #66cc88;
  background: rgba(80, 200, 120, 0.15);
  font-size: 10px;
}

.time-badge.purple {
  color: #aa88dd;
  background: rgba(120, 60, 200, 0.15);
}

.connector {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  margin-top: 30px;
  border: 0;
  background: transparent;
}

.connector-line {
  width: 30px;
  height: 2px;
  background: rgba(255, 255, 255, 0.1);
}

.connector-badge {
  border-radius: 6px;
  padding: 3px 8px;
  color: #66cc88;
  background: rgba(80, 200, 120, 0.1);
  font-size: 10px;
  white-space: nowrap;
}

.connector-badge.purple {
  color: #aa88dd;
  background: rgba(120, 80, 200, 0.1);
}

.rule-badge {
  display: inline-block;
  margin-top: 4px;
  border: 0;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 10px;
}

.rule-optional {
  color: #ccaa44;
  background: rgba(200, 160, 60, 0.15);
}

.rule-plus {
  margin-top: 4px;
  border: 0;
  color: #888;
  background: transparent;
  font-size: 11px;
}

.dot-indicator {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot-green {
  background: #44cc66;
}

.dot-purple {
  background: #9966cc;
}

.add-btn {
  width: 100%;
  margin-top: 16px;
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 14px;
  color: #666;
  background: rgba(255, 255, 255, 0.04);
  font-size: 14px;
  text-align: center;
}

.game-inventory-shell {
  display: grid;
  gap: 10px;
  width: 100%;
  max-height: min(820px, calc(100vh - 36px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 24px 60px rgba(31, 35, 71, 0.18);
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.game-inventory-shell.inventory-empty-shell {
  position: relative;
  height: 100%;
  max-height: none;
  min-height: 0;
  gap: 0;
  align-content: start;
  grid-auto-rows: max-content;
  overflow: hidden;
  border: 0;
  padding: 18px;
  border-radius: 18px;
  color: #10142f;
  background: rgba(255, 255, 255, 0.92);
}

.inventory-choice-hover {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 50%;
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 10px;
  width: min(340px, calc(100% - 36px));
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 42px rgba(31, 35, 71, 0.18);
  transform: translate(-50%, -50%);
}

.inventory-choice-hover.is-search {
  top: 92px;
  width: min(720px, calc(100% - 36px));
  grid-template-columns: repeat(2, minmax(0, 1fr));
  transform: translateX(-50%);
}

.inventory-choice-hover.is-direct {
  top: 92px;
  width: min(720px, calc(100% - 36px));
  grid-template-columns: repeat(2, minmax(0, 1fr));
  transform: translateX(-50%);
}

.inventory-choice-hover button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.78);
  font-size: 14px;
  font-weight: 780;
}

.inventory-choice-hover .inventory-drug-searchbar {
  grid-column: 1 / -1;
  margin-top: 2px;
  box-shadow: none;
}

.inventory-direct-form {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  border: 1px solid rgba(110, 112, 153, 0.18);
  border-radius: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.82);
}

.inventory-direct-form label {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 780;
}

.inventory-direct-form input {
  min-width: 0;
  height: 36px;
  border: 1px solid rgba(110, 112, 153, 0.18);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  font-weight: 720;
}

.inventory-direct-form .game-lookup-status {
  grid-column: 1 / -1;
}

.inventory-direct-form > button {
  grid-column: 1 / -1;
  color: #fff;
  background: var(--indigo);
}

.drug-image-input {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  border: 1px dashed rgba(110, 112, 153, 0.28);
  border-radius: 10px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.drug-image-input label,
.drug-image-input > button {
  display: inline-grid;
  place-items: center;
  min-height: 34px;
  border: 1px solid rgba(110, 112, 153, 0.22);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.drug-image-input > span,
.drug-image-input > em {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 760;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drug-image-input > img {
  width: 44px;
  height: 34px;
  object-fit: cover;
  border-radius: 7px;
  border: 1px solid rgba(110, 112, 153, 0.2);
}

.drug-image-candidates {
  grid-column: 1 / -1;
  display: flex;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.drug-image-candidates::-webkit-scrollbar {
  display: none;
}

.drug-image-candidates button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  border-radius: 8px;
  padding: 0 10px;
  font-size: 12px;
}

.drug-image-candidates small {
  color: var(--muted);
  font-size: 10px;
}

.drug-image-sources {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.drug-image-sources span {
  border: 1px solid rgba(110, 112, 153, 0.18);
  border-radius: 999px;
  padding: 3px 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 760;
}

.inventory-result-layer {
  position: absolute;
  inset: 172px 18px 18px;
  display: grid;
  min-height: 0;
  align-items: stretch;
  pointer-events: none;
}

.inventory-empty-shell:not(:has(.inventory-choice-hover.is-search)) .inventory-result-layer {
  inset: 72px 18px 18px;
}

.inventory-empty-shell:has(.inventory-choice-hover.is-direct) .inventory-result-layer {
  inset: 210px 18px 18px;
}

.inventory-result-layer > * {
  pointer-events: auto;
}

.inventory-drug-workspace {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
  height: 100%;
  min-height: 0;
}

.inventory-drug-results {
  min-height: 0;
  overflow: auto;
  padding: 0 2px 6px;
  scrollbar-width: none;
}

.inventory-drug-results::-webkit-scrollbar {
  display: none;
}

.inventory-drug-searchbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid rgba(110, 112, 153, 0.18);
  border-radius: 14px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 30px rgba(31, 35, 71, 0.12);
}

.inventory-drug-searchbar input {
  min-width: 0;
  height: 40px;
  border: 1px solid rgba(110, 112, 153, 0.18);
  border-radius: 10px;
  padding: 0 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.84);
  font-size: 14px;
}

.inventory-drug-searchbar button {
  min-width: 70px;
  height: 40px;
  border: 1px solid rgba(75, 70, 219, 0.2);
  border-radius: 10px;
  color: #fff;
  background: var(--indigo);
  font-weight: 800;
}

.inventory-drug-searchbar button:disabled {
  opacity: 0.55;
}

.inventory-empty-shell .game-inventory-top h2 {
  color: #10142f;
}

.inventory-empty-shell .game-title-add {
  border-color: rgba(75, 70, 219, 0.22);
  color: #3530c9;
  background: rgba(75, 70, 219, 0.08);
}

.inventory-empty-shell .game-close {
  color: #42486d;
}

.game-inventory-shell::-webkit-scrollbar {
  display: none;
}

.game-inventory-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  position: relative;
  z-index: 4;
}

.game-inventory-top h2 {
  margin: 2px 0 0;
  color: rgba(255, 230, 150, 0.9);
  font-size: 20px;
  line-height: 1.15;
  font-weight: 850;
}

.game-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.game-title-add {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 200, 80, 0.26);
  border-radius: 8px;
  color: rgba(255, 230, 150, 0.92);
  background: rgba(255, 200, 80, 0.08);
  font-size: 22px;
  line-height: 1;
  font-weight: 740;
}

.game-kicker {
  color: rgba(140, 165, 255, 0.42);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.game-close {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 0;
  color: var(--muted);
  background: transparent;
  font-size: 22px;
  line-height: 1;
}

.game-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  border: 1px solid rgba(100, 130, 255, 0.1);
  border-radius: 12px;
  background: rgba(20, 28, 65, 0.48);
}

.game-tabs button,
.game-filter-tabs button {
  min-width: 0;
  min-height: 34px;
  border: 1px solid rgba(100, 130, 255, 0.08);
  border-radius: 8px;
  color: rgba(160, 180, 255, 0.45);
  background: rgba(100, 170, 255, 0.03);
  font-size: 12px;
  font-weight: 800;
}

.game-tabs button.is-active,
.game-filter-tabs button.is-active {
  color: rgba(255, 225, 140, 0.92);
  border-color: rgba(255, 200, 80, 0.2);
  background: rgba(200, 160, 255, 0.1);
}

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

.game-stat-row div {
  display: grid;
  gap: 2px;
  min-width: 0;
  border: 1px solid rgba(100, 130, 255, 0.08);
  border-radius: 10px;
  padding: 10px;
  background: rgba(20, 28, 65, 0.4);
}

.game-stat-row strong {
  color: rgba(120, 150, 255, 0.96);
  font-size: 24px;
  line-height: 1;
}

.game-stat-row span {
  color: rgba(140, 165, 255, 0.45);
  font-size: 10px;
  font-weight: 800;
}

.game-inventory-panel {
  overflow: hidden;
  border: 1px solid rgba(100, 130, 255, 0.08);
  border-radius: 12px;
  background: rgba(20, 28, 65, 0.42);
}

.game-panel-head,
.game-register-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border-bottom: 1px solid rgba(100, 130, 255, 0.06);
}

.game-panel-title {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: rgba(255, 200, 80, 0.78);
  font-size: 12px;
}

.game-cube {
  position: relative;
  width: 13px;
  height: 13px;
  border: 1.7px solid currentColor;
  border-radius: 3px;
}

.game-cube::before,
.game-cube::after {
  content: "";
  position: absolute;
  background: currentColor;
  opacity: 0.55;
}

.game-cube::before {
  left: 5px;
  top: -3px;
  width: 1px;
  height: 17px;
}

.game-cube::after {
  left: -3px;
  top: 5px;
  width: 17px;
  height: 1px;
}

.game-filter-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.game-filter-tabs button {
  min-height: 24px;
  padding: 0 9px;
  font-size: 9px;
}

.game-filter-tabs.compact button {
  min-height: 26px;
  font-size: 10px;
}

.game-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
}

.game-choice-grid button {
  display: grid;
  gap: 5px;
  min-height: 76px;
  border: 1px solid rgba(100, 130, 255, 0.12);
  border-radius: 10px;
  padding: 12px;
  text-align: left;
  background: rgba(100, 170, 255, 0.04);
}

.game-choice-grid strong {
  color: rgba(255, 225, 140, 0.9);
  font-size: 13px;
}

.game-choice-grid span {
  color: rgba(140, 165, 255, 0.5);
  font-size: 10px;
  line-height: 1.35;
}

.game-item-list,
.game-rule-list {
  display: grid;
}

.game-item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 58px;
  padding: 8px;
  border-bottom: 1px solid rgba(100, 130, 255, 0.05);
}

.game-item:last-child {
  border-bottom: 0;
}

.game-item:hover {
  background: rgba(200, 160, 255, 0.05);
}

.game-item-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(100, 130, 255, 0.14);
  background: rgba(100, 170, 255, 0.06);
}

.game-item-icon span {
  color: rgba(180, 200, 255, 0.75);
  font-size: 12px;
  font-weight: 850;
}

.game-item-icon em {
  position: absolute;
  right: -2px;
  bottom: -3px;
  max-width: 40px;
  overflow: hidden;
  border: 1px solid rgba(100, 130, 255, 0.16);
  border-radius: 4px;
  padding: 1px 4px;
  color: rgba(200, 220, 255, 0.82);
  background: rgba(10, 14, 42, 0.9);
  font-size: 7px;
  font-style: normal;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-item-icon.green {
  background: rgba(80, 200, 140, 0.08);
  border-color: rgba(80, 200, 140, 0.16);
}

.game-item-icon.gold {
  background: rgba(255, 180, 80, 0.08);
  border-color: rgba(255, 180, 80, 0.14);
}

.game-item-icon.violet,
.game-item-icon.purple {
  background: rgba(150, 120, 230, 0.09);
  border-color: rgba(180, 140, 255, 0.14);
}

.game-item-icon.orange {
  background: rgba(255, 130, 72, 0.08);
  border-color: rgba(255, 130, 72, 0.16);
}

.game-item-info {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.game-item-name,
.game-item-sub {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-item-name {
  color: rgba(220, 230, 255, 0.9);
  font-size: 13px;
  font-weight: 820;
}

.game-item-name span {
  color: rgba(140, 165, 255, 0.5);
  font-weight: 700;
}

.game-item-sub {
  color: rgba(140, 165, 255, 0.42);
  font-size: 9px;
  font-weight: 720;
}

.game-item-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 4px;
}

.game-use,
.game-set,
.game-add-button {
  border-radius: 6px;
  font-weight: 780;
}

.game-use,
.game-set {
  min-height: 26px;
  border: 1px solid rgba(100, 130, 255, 0.1);
  padding: 0 10px;
  font-size: 9px;
}

.game-use {
  color: rgba(100, 220, 170, 0.74);
  background: rgba(100, 200, 160, 0.08);
  border-color: rgba(100, 200, 160, 0.14);
}

.game-set {
  color: rgba(160, 180, 255, 0.42);
  background: transparent;
}

.game-register {
  border-top: 1px solid rgba(100, 130, 255, 0.06);
}

.game-register-head strong {
  color: rgba(255, 200, 80, 0.72);
  font-size: 12px;
}

.game-register-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
}

.game-register-grid label {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: rgba(140, 165, 255, 0.48);
  font-size: 9px;
  font-weight: 820;
}

.game-register-grid input {
  min-width: 0;
  min-height: 30px;
  border: 1px solid rgba(100, 130, 255, 0.12);
  border-radius: 7px;
  padding: 0 8px;
  color: rgba(220, 230, 255, 0.9);
  background: rgba(10, 14, 42, 0.52);
  font-size: 11px;
}

.game-register-grid input::placeholder {
  color: rgba(140, 165, 255, 0.28);
}

.game-mini-link {
  min-height: 24px;
  border: 1px solid rgba(100, 130, 255, 0.1);
  border-radius: 6px;
  padding: 0 8px;
  color: rgba(160, 180, 255, 0.5);
  background: rgba(100, 170, 255, 0.04);
  font-size: 9px;
  font-weight: 760;
}

.game-drug-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px;
  gap: 8px;
  padding: 10px;
}

.game-drug-search label {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: rgba(140, 165, 255, 0.48);
  font-size: 9px;
  font-weight: 820;
}

.game-drug-search input {
  min-width: 0;
  min-height: 34px;
  border: 1px solid rgba(100, 130, 255, 0.12);
  border-radius: 7px;
  padding: 0 9px;
  color: rgba(220, 230, 255, 0.9);
  background: rgba(10, 14, 42, 0.52);
  font-size: 12px;
}

.game-api-route {
  margin: 0 10px 10px;
  border-left: 3px solid rgba(100, 170, 255, 0.22);
  padding: 7px 9px;
  color: rgba(140, 165, 255, 0.44);
  background: rgba(100, 170, 255, 0.04);
  font-size: 10px;
  font-weight: 720;
}

.game-lookup-status {
  display: grid;
  gap: 4px;
  margin: 0 10px 10px;
  border: 1px solid rgba(100, 130, 255, 0.12);
  border-radius: 9px;
  padding: 9px;
  background: rgba(100, 170, 255, 0.04);
}

.game-lookup-status.loading {
  border-color: rgba(250, 199, 117, 0.2);
  background: rgba(250, 199, 117, 0.05);
}

.game-lookup-status.ok {
  border-color: rgba(100, 200, 160, 0.18);
  background: rgba(100, 200, 160, 0.05);
}

.game-lookup-status.warn {
  border-color: rgba(255, 130, 72, 0.18);
  background: rgba(255, 130, 72, 0.05);
}

.game-lookup-status strong {
  color: rgba(220, 230, 255, 0.86);
  font-size: 11px;
}

.game-lookup-status span {
  color: rgba(140, 165, 255, 0.48);
  font-size: 10px;
  line-height: 1.4;
}

.game-source-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.game-source-list em {
  border: 1px solid rgba(100, 130, 255, 0.1);
  border-radius: 5px;
  padding: 2px 6px;
  color: rgba(140, 165, 255, 0.48);
  background: rgba(10, 14, 42, 0.38);
  font-size: 8px;
  font-style: normal;
  font-weight: 760;
}

.game-source-list em.ok {
  color: rgba(100, 220, 170, 0.7);
  border-color: rgba(100, 200, 160, 0.16);
}

.game-source-list em.fail {
  color: rgba(255, 130, 100, 0.58);
  border-color: rgba(255, 130, 72, 0.14);
}

.game-add-button {
  width: calc(100% - 20px);
  min-height: 34px;
  margin: 0 10px 10px;
  border: 1px solid rgba(160, 180, 255, 0.16);
  color: rgba(160, 180, 255, 0.58);
  background: rgba(100, 130, 255, 0.05);
  font-size: 11px;
}

.game-rule {
  display: grid;
  grid-template-columns: minmax(120px, 0.32fr) minmax(90px, 0.2fr) minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 9px 10px;
  border-bottom: 1px solid rgba(100, 130, 255, 0.05);
}

.game-rule strong {
  color: rgba(220, 230, 255, 0.9);
  font-size: 12px;
}

.game-rule span {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(200, 160, 255, 0.12);
  border-radius: 6px;
  color: rgba(200, 160, 255, 0.58);
  background: rgba(200, 160, 255, 0.06);
  font-size: 9px;
  font-weight: 760;
}

.game-rule p {
  margin: 0;
  color: rgba(140, 165, 255, 0.5);
  font-size: 10px;
  line-height: 1.35;
}

.inventory-layout-blank {
  min-height: 250px;
}

.rule-grid {
  grid-template-columns: minmax(0, 0.7fr) minmax(0, 0.7fr) minmax(0, 1.6fr);
}

.game-chip,
.game-empty {
  border: 1px solid rgba(100, 130, 255, 0.1);
  border-radius: 7px;
  color: rgba(160, 180, 255, 0.48);
  background: rgba(100, 170, 255, 0.04);
  font-size: 10px;
  font-weight: 760;
}

.game-chip {
  padding: 5px 9px;
}

.game-empty {
  margin: 10px;
  padding: 18px;
  text-align: center;
}

.drug-knowledge-card {
  display: block;
  padding: 10px 0 0;
  border-top: 1px solid rgba(100, 130, 255, 0.06);
}

.drug-phone {
  display: contents;
  font-family: "SF Pro Display", Pretendard, -apple-system, sans-serif;
}

.drug-phone-bg {
  display: none;
}

.drug-popup {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(160, 180, 255, 0.1);
  border-radius: 18px;
  padding-top: 16px;
  background: rgba(12, 16, 42, 0.97);
  font-family: "SF Pro Display", Pretendard, -apple-system, sans-serif;
}

.drug-popup-head {
  padding: 0 18px;
}

.drug-badges {
  display: flex;
  gap: 5px;
  margin-bottom: 10px;
}

.drug-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 7px;
  padding: 3px 9px;
  font-size: 10px;
}

.drug-badge.red {
  color: #f09595;
  background: rgba(226, 75, 74, 0.1);
}

.drug-badge.amber {
  color: #fac775;
  background: rgba(239, 159, 39, 0.1);
}

.drug-title,
.drug-subtitle,
.drug-dose-row {
  margin-left: 18px;
  margin-right: 18px;
}

.drug-title {
  color: #e8ecff;
  font-size: 22px;
  line-height: 1.15;
  font-weight: 600;
}

.drug-subtitle {
  margin-top: 2px;
  margin-bottom: 10px;
  color: #6a7aaa;
  font-size: 13px;
}

.drug-dose-row {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.drug-dose-row span {
  border: 1px solid rgba(160, 180, 255, 0.07);
  border-radius: 10px;
  padding: 6px 12px;
  color: #4e5e8a;
  font-size: 12px;
}

.drug-dose-row span.on {
  color: #a0b4ff;
  border-color: rgba(160, 180, 255, 0.22);
  background: rgba(160, 180, 255, 0.1);
  font-weight: 500;
}

.drug-tabs {
  display: flex;
  gap: 4px;
  padding: 0 18px;
  margin-bottom: 14px;
}

.drug-tabs button {
  flex: 1;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 0;
  font-size: 13px;
}

.drug-tabs button.on {
  color: #a0b4ff;
  border-color: rgba(160, 180, 255, 0.18);
  background: rgba(160, 180, 255, 0.1);
  font-weight: 500;
}

.drug-tabs button.off {
  color: #4e5e8a;
  background: rgba(160, 180, 255, 0.02);
}

.drug-scroll {
  max-height: 520px;
  overflow-y: auto;
  padding: 0 18px 24px;
  scrollbar-width: none;
}

.drug-scroll::-webkit-scrollbar {
  display: none;
}

.drug-section-copy,
.drug-source-copy {
  color: #8090cc;
  font-size: 12px;
  line-height: 1.6;
}

.drug-section-copy {
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(160, 180, 255, 0.06);
  margin-bottom: 14px;
}

.drug-section-copy span,
.drug-source-copy {
  color: #5a6a99;
}

.drug-timeline-card,
.drug-info-card,
.drug-safety-link {
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 14px;
  background: rgba(160, 180, 255, 0.04);
}

.drug-small-label {
  color: #5a6a99;
  font-size: 11px;
  margin-bottom: 8px;
}

.drug-timeline-bar {
  position: relative;
  display: flex;
  height: 36px;
  overflow: hidden;
  border-radius: 8px;
  margin-bottom: 4px;
}

.drug-timeline-bar i:nth-of-type(1) { background: #2a5a3a; }
.drug-timeline-bar i:nth-of-type(2) { background: #4a8a3a; }
.drug-timeline-bar i:nth-of-type(3) { background: #8aaa3a; }
.drug-timeline-bar i:nth-of-type(4) { background: #c4a030; }
.drug-timeline-bar i:nth-of-type(5) { background: #b06a28; }
.drug-timeline-bar i:nth-of-type(6) { background: #1a2040; }

.drug-timeline-bar b {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.65);
  font-size: 8px;
  font-weight: 500;
}

.drug-time-labels {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  color: #3e4e78;
  font-size: 8px;
}

.drug-pk-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.drug-pk-grid div {
  border-radius: 8px;
  padding: 8px;
  text-align: center;
  background: rgba(160, 180, 255, 0.06);
}

.drug-pk-grid span,
.drug-pk-grid em {
  display: block;
  color: #5a6a99;
  font-size: 9px;
  font-style: normal;
}

.drug-pk-grid strong {
  display: block;
  overflow-wrap: anywhere;
  color: #a0b4ff;
  font-size: 16px;
}

.drug-info-card {
  border-radius: 12px;
}

.drug-info-card.amber {
  border: 1px solid rgba(239, 159, 39, 0.08);
  background: rgba(239, 159, 39, 0.04);
}

.drug-info-card.red {
  border: 1px solid rgba(226, 75, 74, 0.08);
  background: rgba(226, 75, 74, 0.04);
}

.drug-a-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.drug-a-label span {
  border-radius: 5px;
  padding: 2px 7px;
  color: white;
  background: #3b5bdb;
  font-size: 10px;
  font-weight: 700;
}

.drug-a-label strong {
  color: #c8d4ff;
  font-size: 13px;
}

.drug-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(160, 180, 255, 0.04);
}

.drug-row:last-child {
  border-bottom: 0;
}

.drug-row span {
  color: #5a6a99;
  font-size: 12px;
}

.drug-row strong {
  min-width: 0;
  color: #8ad4b8;
  font-size: 12px;
  text-align: right;
  overflow-wrap: anywhere;
}

.drug-info-card p {
  margin: 6px 0 0;
  color: #8090cc;
  font-size: 11px;
  line-height: 1.6;
}

.drug-region-tags,
.drug-side-effects {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.drug-region-tags span,
.drug-side-effects span {
  border-radius: 18px;
  padding: 3px 9px;
  color: #a0b4ff;
  border: 1px solid rgba(160, 180, 255, 0.2);
  background: rgba(160, 180, 255, 0.08);
  font-size: 11px;
}

.drug-side-effects span {
  border: 0;
  border-radius: 8px;
  color: #f09595;
  background: rgba(226, 75, 74, 0.08);
}

.drug-safety-link {
  display: grid;
  gap: 2px;
  border: 1px solid rgba(160, 180, 255, 0.08);
}

.drug-safety-link strong {
  color: #c8d4ff;
  font-size: 13px;
}

.drug-safety-link span {
  color: #4e5e8a;
  font-size: 11px;
}

.drug-source-copy {
  margin: 10px 0;
  padding: 8px 0;
  border-top: 1px solid rgba(160, 180, 255, 0.04);
  font-size: 10px;
}

.drug-source-copy span {
  color: #5a6a99;
}

.medication-popup-schema {
  padding: 14px 0 0;
  border-top: 1px solid rgba(72, 68, 64, 0.06);
}

.medication-popup-schema .pop5 {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  width: min(100%, 560px);
  min-height: 720px;
  margin: 0 auto;
  border: 1px solid rgba(72, 68, 64, 0.10);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.99);
  color: #3d2514;
  font-family: "SF Pro Display", Pretendard, -apple-system, sans-serif;
}

.medication-popup-schema .med-pop-head {
  flex-shrink: 0;
  padding: 18px 18px 0;
}

.medication-popup-schema .med-head-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.medication-popup-schema .med-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.medication-popup-schema .drug-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border-radius: 7px;
  padding: 3px 9px;
  font-size: 10px;
}

.medication-popup-schema .drug-badge i {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
}

.medication-popup-schema .drug-badge.red {
  color: #d04038;
  background: rgba(200, 50, 40, 0.12);
}

.medication-popup-schema .drug-badge.amber,
.medication-popup-schema .drug-badge:not(.red) {
  color: #8a7e76;
  background: rgba(180, 100, 20, 0.10);
}

.medication-popup-schema .med-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 10px;
  background: rgba(72, 68, 64, 0.06);
  color: #5c3d24;
  font-size: 22px;
  line-height: 1;
}

.medication-popup-schema .drug-title {
  margin: 0;
  color: #2d1f14;
  font-size: 22px;
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.medication-popup-schema .drug-subtitle {
  margin: 2px 0 10px;
  color: #634530;
  font-size: 13px;
}

.medication-popup-schema .drug-dose-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
}

.medication-popup-schema .drug-dose-row span {
  border: 1px solid rgba(72, 68, 64, 0.07);
  border-radius: 10px;
  padding: 6px 12px;
  color: #6b4a2e;
  font-size: 12px;
}

.medication-popup-schema .drug-dose-row span.on {
  border-color: rgba(72, 68, 64, 0.22);
  background: rgba(72, 68, 64, 0.10);
  color: #484540;
  font-weight: 500;
}

.medication-popup-schema .tb {
  display: flex;
  gap: 4px;
  padding: 0 18px;
  margin-bottom: 14px;
}

.medication-popup-schema .tbtn {
  flex: 1;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 0;
  text-align: center;
  color: #6b4a2e;
  background: rgba(72, 68, 64, 0.02);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.medication-popup-schema .tbtn.on {
  border-color: #5c3d24;
  background: #5c3d24;
  color: #fffdf9;
  font-weight: 800;
}

.medication-popup-schema .ps5 {
  flex: 1;
  overflow-y: auto;
  padding: 0 18px 24px;
  scrollbar-width: none;
}

.medication-popup-schema .ps5::-webkit-scrollbar {
  display: none;
}

.medication-popup-schema .term2 {
  color: inherit;
  border-bottom: 1px dashed rgba(72, 68, 64, 0.3);
  padding-bottom: 1px;
}

.medication-popup-schema .drug-section-copy,
.medication-popup-schema .drug-source-copy {
  color: #4e3220;
  font-size: 12px;
  line-height: 1.6;
}

.medication-popup-schema .drug-section-copy {
  border-bottom: 1px solid rgba(72, 68, 64, 0.06);
  padding: 0 0 14px;
  margin-bottom: 14px;
  text-align: center;
}

.medication-popup-schema .drug-section-copy span,
.medication-popup-schema .drug-source-copy {
  color: #5c3d24;
}

.medication-popup-schema .drug-indication-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
}

.medication-popup-schema .drug-indication-list em {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 5px 10px;
  border: 1px solid rgba(92, 61, 36, 0.14);
  border-radius: 9px;
  background: rgba(72, 68, 64, 0.04);
  color: #4e3220;
  font-style: normal;
  font-weight: 600;
  line-height: 1.35;
}

.medication-popup-schema .drug-timeline-card,
.medication-popup-schema .drug-info-card {
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 14px;
  background: rgba(72, 68, 64, 0.04);
}

.medication-popup-schema .drug-small-label {
  color: #5c3d24;
  font-size: 11px;
  margin-bottom: 8px;
}

.medication-popup-schema .drug-timeline-bar {
  position: relative;
  display: flex;
  overflow: hidden;
  height: 36px;
  border-radius: 8px;
  margin-bottom: 4px;
}

.medication-popup-schema .drug-timeline-bar i:nth-of-type(1) { background: #2d5a27; }
.medication-popup-schema .drug-timeline-bar i:nth-of-type(2) { background: #3d7a30; }
.medication-popup-schema .drug-timeline-bar i:nth-of-type(3) { background: #4a8a35; }
.medication-popup-schema .drug-timeline-bar i:nth-of-type(4) { background: #c4843a; }
.medication-popup-schema .drug-timeline-bar i:nth-of-type(5) { background: #8a5a30; }
.medication-popup-schema .drug-timeline-bar i:nth-of-type(6) { background: #d8cfc4; }

.medication-popup-schema .drug-timeline-bar.dynamic {
  display: block;
  background: #d8cfc4;
}

.medication-popup-schema .drug-timeline-bar.dynamic i {
  position: absolute;
  top: 0;
  bottom: 0;
}

.medication-popup-schema .drug-timeline-bar.dynamic .seg-1 { background: #2d5a27; }
.medication-popup-schema .drug-timeline-bar.dynamic .seg-2 { background: #4a8a35; }
.medication-popup-schema .drug-timeline-bar.dynamic .seg-3 { background: #c4843a; }
.medication-popup-schema .drug-timeline-bar.dynamic .seg-4 { background: #8a5a30; }

.medication-popup-schema .drug-timeline-bar b {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  color: rgba(60, 30, 10, 0.65);
  font-size: 8px;
  font-weight: 500;
  white-space: nowrap;
}

.medication-popup-schema .drug-time-labels {
  display: flex;
  justify-content: space-between;
  padding: 0 2px;
  margin-bottom: 10px;
  color: #7a5c3a;
  font-size: 8px;
}

.medication-popup-schema .drug-pk-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.medication-popup-schema .drug-pk-grid div {
  border-radius: 8px;
  padding: 8px;
  text-align: center;
  background: rgba(72, 68, 64, 0.06);
}

.medication-popup-schema .drug-pk-grid span,
.medication-popup-schema .drug-pk-grid em {
  display: block;
  color: #5c3d24;
  font-size: 9px;
  font-style: normal;
}

.medication-popup-schema .drug-pk-grid strong {
  display: block;
  color: #484540;
  font-size: 18px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.medication-popup-schema .drug-a-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}

.medication-popup-schema .drug-a-label span {
  border-radius: 5px;
  padding: 2px 7px;
  color: white;
  background: #3b5bdb;
  font-size: 10px;
  font-weight: 700;
}

.medication-popup-schema .drug-a-label strong {
  color: #3d2514;
  font-size: 13px;
  font-weight: 700;
}

.medication-popup-schema .drug-card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.medication-popup-schema .drug-line-chevron {
  position: relative;
  width: 32px;
  height: 28px;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.medication-popup-schema .drug-line-chevron::before,
.medication-popup-schema .drug-line-chevron::after {
  content: "";
  position: absolute;
  top: 12px;
  width: 15px;
  height: 4px;
  border-radius: 3px;
  background: #d04038;
}

.medication-popup-schema .drug-line-chevron::before {
  left: 5px;
  transform: rotate(32deg);
}

.medication-popup-schema .drug-line-chevron::after {
  right: 5px;
  transform: rotate(-32deg);
}

.medication-popup-schema .drug-line-chevron.is-open::before {
  transform: rotate(-32deg);
}

.medication-popup-schema .drug-line-chevron.is-open::after {
  transform: rotate(32deg);
}

.medication-popup-schema .rw,
.medication-popup-schema .drug-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(72, 68, 64, 0.04);
  padding: 8px 0;
}

.medication-popup-schema .rw:last-child,
.medication-popup-schema .drug-row:last-child {
  border-bottom: 0;
}

.medication-popup-schema .rw span,
.medication-popup-schema .drug-row span {
  color: #5c3d24;
  font-size: 12px;
}

.medication-popup-schema .rw span:last-child,
.medication-popup-schema .drug-row strong {
  color: #4a3020;
  font-size: 12px;
  font-weight: 600;
  text-align: right;
  overflow-wrap: anywhere;
}

.medication-popup-schema .drug-pill-row,
.medication-popup-schema .drug-region-tags,
.medication-popup-schema .drug-side-effects {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.medication-popup-schema .drug-pill-row span,
.medication-popup-schema .drug-region-tags span {
  border: 1px solid rgba(72, 68, 64, 0.2);
  border-radius: 18px;
  padding: 3px 9px;
  color: #5c4a3a;
  background: rgba(72, 68, 64, 0.08);
  font-size: 11px;
}

.medication-popup-schema .drug-lang-toggle {
  border: 0;
  padding: 0;
  color: #5c3d24;
  background: transparent;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.medication-popup-schema .drug-system-table {
  display: grid;
  gap: 0;
  margin-top: 10px;
  border-top: 1px solid rgba(72, 68, 64, 0.08);
}

.medication-popup-schema .drug-system-table > div {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 1fr;
  gap: 8px;
  align-items: start;
  padding: 8px 0;
  border-bottom: 1px solid rgba(72, 68, 64, 0.08);
}

.medication-popup-schema .drug-system-table b,
.medication-popup-schema .drug-system-table span {
  min-width: 0;
  color: #5c3d24;
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.medication-popup-schema .drug-system-table b {
  color: #8c7058;
  font-weight: 800;
}

.medication-popup-schema [data-target-language="ko"] .en,
.medication-popup-schema [data-target-language="en"] .ko {
  display: none;
}

.medication-popup-schema .drug-data-table em,
.medication-popup-schema .drug-system-table em {
  font-style: normal;
}

.medication-popup-schema .drug-side-effects span {
  border-radius: 8px;
  padding: 4px 10px;
  color: #d04038;
  background: rgba(226, 75, 74, 0.08);
  font-size: 11px;
}

.medication-popup-schema .drug-brain-subtitle,
.medication-popup-schema .drug-footnote,
.medication-popup-schema .drug-info-card p {
  color: #8c7058;
  font-size: 10px;
  line-height: 1.5;
}

.medication-popup-schema .drug-brain-subtitle {
  margin-bottom: 8px;
  font-size: 11px;
}

.medication-popup-schema .drug-brain-bars {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 86px;
  margin: 10px 0 5px;
}

.medication-popup-schema .drug-brain-bars div {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.medication-popup-schema .drug-brain-bars i {
  display: block;
  width: 100%;
  border-radius: 2px 2px 0 0;
  background: #7c6a5a;
  opacity: 0.85;
}

.medication-popup-schema .drug-brain-bars span {
  color: #8c7058;
  font-size: 9px;
  white-space: nowrap;
}

.medication-popup-schema .drug-detail-title,
.medication-popup-schema .drug-safety-title {
  padding: 8px 0;
  color: #5c3d24;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
}

.medication-popup-schema .drug-safety-link {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(72, 68, 64, 0.08);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 14px;
  background: rgba(72, 68, 64, 0.04);
}

.medication-popup-schema .drug-safety-link strong {
  display: block;
  color: #3d2514;
  font-size: 13px;
  font-weight: 500;
}

.medication-popup-schema .drug-safety-link span {
  display: block;
  margin-top: 2px;
  color: #6b4a2e;
  font-size: 11px;
}

.medication-popup-schema .drug-safety-icon {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: rgba(196, 160, 255, 0.08);
  color: #5c5048;
}

.medication-popup-schema .drug-safety-link b {
  margin-left: auto;
  color: rgba(72, 68, 64, 0.4);
  font-size: 24px;
  font-weight: 400;
}

.medication-popup-schema .drug-warning-lines {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.medication-popup-schema .drug-warning-lines p {
  display: flex;
  gap: 7px;
  margin: 0;
  color: #5c3d24;
  font-size: 12px;
  line-height: 1.5;
}

.medication-popup-schema .drug-warning-lines span {
  color: #c4843a;
}

.medication-popup-schema .drug-dur-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 12px;
}

.medication-popup-schema .drug-dur-grid div {
  border-radius: 8px;
  padding: 8px 10px;
  text-align: center;
  background: #fff;
}

.medication-popup-schema .drug-dur-grid .wide {
  grid-column: 1 / -1;
}

.medication-popup-schema .drug-dur-grid span {
  display: block;
  margin-bottom: 3px;
  color: #8a7e76;
  font-size: 10px;
}

.medication-popup-schema .drug-dur-grid strong {
  color: #3d7a30;
  font-size: 13px;
  font-weight: 700;
}

.medication-popup-schema .drug-dur-grid strong.warn {
  color: #c4843a;
}

.medication-popup-schema .drug-source-copy {
  border-top: 1px solid rgba(72, 68, 64, 0.04);
  margin: 10px 0;
  padding: 8px 0;
  text-align: center;
  font-size: 10px;
}

.medication-popup-schema .more-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 8px;
  padding: 6px 12px;
  margin-top: 8px;
  color: #6a4828;
  background: rgba(72, 68, 64, 0.04);
  font-size: 11px;
}

.medication-popup-schema .drug-missing {
  color: #8a7e76 !important;
  font-weight: 500;
}

.medication-popup-schema .drug-data-table {
  display: grid;
  gap: 0;
  margin-top: 10px;
  border-top: 1px solid rgba(72, 68, 64, 0.08);
}

.medication-popup-schema .drug-data-table > div {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(72, 68, 64, 0.08);
}

.medication-popup-schema .drug-data-table.affinity > div {
  grid-template-columns: 1.15fr 0.75fr 0.95fr 0.58fr 0.82fr 0.58fr;
}

.medication-popup-schema .drug-data-table.affinity > div.binding-collapsed-note {
  display: block;
  padding: 7px 0;
}

.medication-popup-schema .drug-data-table.affinity > div.binding-collapsed-note span {
  color: #8c7058;
  font-size: 11px;
  font-weight: 700;
}

.medication-popup-schema .drug-data-table.affinity > div.is-low-affinity span {
  color: #8c7058;
}

.medication-popup-schema .drug-data-table.affinity > div.is-hidden,
.medication-popup-schema .drug-column-help-popover {
  display: none;
}

.medication-popup-schema .drug-data-table b {
  color: #8c7058;
  font-size: 11px;
  font-weight: 700;
}

.medication-popup-schema .drug-column-help-wrap {
  position: relative;
  min-width: 0;
}

.medication-popup-schema .drug-column-help-trigger {
  display: inline;
  border: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.medication-popup-schema .drug-column-help-popover {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 4;
  width: min(220px, calc(100vw - 40px));
  border: 1px solid rgba(72, 68, 64, 0.12);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fffdf9;
  box-shadow: 0 10px 24px rgba(72, 68, 64, 0.12);
  color: #5c3d24;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.medication-popup-schema .drug-column-help-popover.is-open {
  display: block;
}

.medication-popup-schema .drug-data-table.affinity > div:first-child .drug-column-help-wrap:nth-last-child(-n+2) .drug-column-help-popover {
  right: 0;
  left: auto;
}

.medication-popup-schema .drug-data-table span {
  min-width: 0;
  color: #5c3d24;
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.medication-popup-schema .drug-measurement-help,
.medication-popup-schema .drug-binding-value-help {
  position: relative;
  cursor: help;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-color: rgba(92, 61, 36, 0.35);
  text-underline-offset: 3px;
}

.medication-popup-schema .drug-binding-value-help {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.medication-popup-schema .drug-binding-value-help small {
  color: #1aa04a;
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
}

.medication-popup-schema .drug-measurement-help::after,
.medication-popup-schema .drug-binding-value-help::after {
  content: attr(data-help);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 5;
  display: none;
  width: min(240px, calc(100vw - 40px));
  border: 1px solid rgba(72, 68, 64, 0.12);
  border-radius: 8px;
  padding: 9px 11px;
  background: #fffdf9;
  box-shadow: 0 10px 24px rgba(72, 68, 64, 0.12);
  color: #5c3d24;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
  white-space: normal;
  transform: translateX(-50%);
}

.medication-popup-schema .drug-measurement-help:hover::after,
.medication-popup-schema .drug-measurement-help:focus::after,
.medication-popup-schema .drug-binding-value-help:hover::after,
.medication-popup-schema .drug-binding-value-help:focus::after {
  display: block;
}

@media (min-width: 768px) {
  .medication-popup-schema .pop5 {
    width: min(100%, 620px);
  }
}

.inventory-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 16px 0 12px;
}

.inventory-summary div {
  display: grid;
  gap: 2px;
  border-radius: 14px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.62);
}

.inventory-summary strong {
  color: var(--indigo);
  font-size: 22px;
  line-height: 1;
}

.inventory-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.inventory-list {
  display: grid;
  gap: 8px;
}

.inventory-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  border: 1px solid rgba(110, 112, 153, 0.16);
  border-radius: 14px;
  padding: 10px 12px;
  color: var(--text);
  text-align: left;
  background: rgba(255, 255, 255, 0.58);
}

.inventory-row:hover {
  border-color: rgba(75, 70, 219, 0.32);
  background: rgba(236, 235, 255, 0.72);
}

.inventory-capsule {
  width: 23px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--indigo) 0 50%, white 50% 100%);
  box-shadow: inset 0 0 0 1px rgba(75, 70, 219, 0.28);
  transform: rotate(-24deg);
}

.inventory-capsule.low {
  background: linear-gradient(90deg, var(--orange) 0 50%, white 50% 100%);
  box-shadow: inset 0 0 0 1px rgba(244, 124, 54, 0.36);
}

.inventory-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.inventory-main strong,
.inventory-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inventory-main strong {
  font-size: 14px;
  line-height: 1.15;
}

.inventory-main small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.inventory-stock {
  min-height: 27px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  color: var(--indigo);
  background: var(--indigo-soft);
  font-size: 12px;
  font-weight: 850;
}

.inventory-stock.is-low {
  color: var(--orange);
  background: var(--orange-soft);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.medication-form {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 10px 12px;
  align-items: center;
  margin: 18px 0;
}

.medication-form .primary-button {
  grid-column: 2;
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-radius: 16px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.62);
}

.activity-list {
  display: grid;
  gap: 16px;
}

.activity-item {
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}

.activity-item summary {
  cursor: pointer;
  font-weight: 820;
}

.activity-item summary span {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-left: 8px;
  border-radius: 50%;
  color: white;
  background: var(--indigo);
  font-size: 12px;
}

:focus-visible {
  outline: 3px solid rgba(75, 70, 219, 0.45);
  outline-offset: 3px;
}

@media (max-width: 780px) {
  .shell {
    padding: 12px 12px 102px;
  }

  .app-header h1 {
    font-size: 32px;
  }

  .header-actions {
    gap: 8px;
  }

  .icon-button {
    width: 44px;
    height: 44px;
  }

  .filter-panel {
    padding: 12px;
    border-radius: 18px;
  }

  .category-rail {
    width: 100%;
    max-width: 100%;
  }

  .purpose-filter {
    width: 100%;
    max-width: 100%;
    padding: 12px;
    overflow: hidden;
  }

  .tag-inline,
  .device-filter-block {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .tag-inline {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .tag-inline .chip-list,
  .tag-inline .inline-segmented,
  .device-filter-block .device-strip,
  .device-filter-block .mini-segmented {
    grid-column: auto;
  }

  .tag-inline .chip-list {
    grid-column: 1 / -1;
  }

  .tag-inline .inline-segmented {
    grid-column: 2;
    grid-row: 1;
  }

  .device-filter-block .mini-segmented {
    justify-self: start;
  }

  .filter-row {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 11px 0;
  }

  .tag-filter-row {
    grid-template-columns: 1fr;
  }

  .device-filter-row {
    grid-template-columns: 1fr;
  }

  .device-filter-row .mini-segmented {
    width: min(260px, 100%);
  }

  .filter-summary {
    justify-content: flex-start;
    font-size: 13px;
    white-space: normal;
  }

  .review-card {
    grid-template-columns: 78px minmax(0, 1fr);
    gap: 10px;
    min-height: 116px;
    padding: 12px;
    border-radius: 16px;
  }

  .card-score {
    grid-column: 1 / -1;
    grid-row: auto;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 12px;
    justify-items: start;
  }

  .card-score strong {
    font-size: 22px;
  }

  .editor-grid,
  .device-dashboard {
    grid-template-columns: 1fr;
  }

  .create-board {
    border-radius: 16px;
    padding: 12px;
  }

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

  .create-status {
    grid-column: 1 / -1;
    justify-content: space-between;
  }

  .create-status span {
    display: inline;
  }

  .create-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .create-section {
    border-radius: 14px;
    padding: 12px;
    overflow: hidden;
  }

  .purpose-row {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 8px 0;
  }

  .purpose-row strong {
    line-height: 1.2;
  }

  .segment-section .section-heading {
    display: grid;
    gap: 8px;
  }

  .segment-section .inline-actions {
    justify-content: flex-end;
  }

  .segment-table {
    min-width: 500px;
  }

  .wide {
    grid-column: auto;
  }

  .bottom-nav {
    min-height: 70px;
    border-radius: 24px;
    width: calc(100% - 24px);
  }

  .bottom-nav button {
    font-size: 10px;
  }

  .medication-form {
    grid-template-columns: 1fr;
  }

  .medication-form .primary-button {
    grid-column: auto;
  }

  .inventory-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .game-register-grid,
  .rule-grid,
  .game-choice-grid,
  .game-drug-search {
    grid-template-columns: 1fr;
  }

  .supplement-dashboard {
    padding: 0 8px;
  }

  .supplement-header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .header-inventory-button,
  .header-chain-button {
    min-height: 40px;
    padding: 0 13px;
    font-size: 13px;
  }

  .supp-residual-row {
    grid-template-columns: 92px minmax(0, 1fr) 48px;
    gap: 7px;
  }

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

  .game-panel-head,
  .game-register-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .game-filter-tabs {
    justify-content: flex-start;
  }

  .game-rule {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .phase-screen {
    padding: 22px 14px 104px;
  }

  .phase-page h1 {
    font-size: 26px;
  }

  .cycle-card-grid {
    grid-template-columns: 1fr;
  }

  .app-header {
    align-items: center;
    padding: 0 12px;
    flex-direction: column;
  }

  .app-header h1 {
    font-size: 28px;
  }

  .app-header p {
    font-size: 16px;
  }

  .shell {
    width: min(366px, 100%);
    margin: 0;
    padding: 12px 0 102px;
  }

  .supplement-dashboard {
    padding: 0;
  }

  .supplement-section {
    border-radius: 14px;
    padding: 10px;
  }

  .supp-section-head h2 {
    font-size: 16px;
  }

  .supp-section-head span {
    font-size: 10px;
  }

  .supp-timeline-grid,
  .supp-chain-card {
    min-width: 520px;
  }

  .supp-time-head,
  .supp-tl-row {
    grid-template-columns: 76px repeat(5, minmax(78px, 1fr));
  }

  .supp-residual-row {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .supp-residual-row em {
    grid-column: 2;
    text-align: left;
  }

  .create-board {
    width: 100%;
    margin: 0;
  }

  .top-tab {
    min-height: 42px;
    font-size: 14px;
  }

  .label-full {
    display: none;
  }

  .label-short {
    display: inline;
  }

  .segmented,
  .mini-segmented {
    min-width: 0;
  }

  .segment,
  .mini-segmented button {
    min-height: 40px;
  }

  .chip {
    min-height: 29px;
    padding: 0 10px;
    font-size: 12px;
  }

  .create-board .chip-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    max-width: 100%;
  }

  .create-board .chip {
    min-height: 30px;
    width: 100%;
    max-width: 100%;
    padding: 0 9px;
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .create-board .title-input {
    min-height: 36px;
    font-size: 15px;
  }

  .compact-button {
    min-height: 36px;
    padding: 0 10px;
  }

  .record-actions {
    gap: 5px;
  }

  .inventory-button {
    width: 32px;
    height: 32px;
    border-radius: 9px;
  }

  .game-inventory-shell {
    border-radius: 16px;
    padding: 10px;
  }

  .game-item {
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .game-item-actions {
    grid-column: 2;
  }

  .game-use,
  .game-set {
    flex: 1 1 auto;
  }

  .create-section-head {
    margin-bottom: 8px;
  }

  .create-section-head h2 {
    font-size: 16px;
  }

  .create-section-head span {
    font-size: 11px;
  }

  .create-device-strip {
    display: grid;
    grid-template-columns: repeat(4, 42px);
    gap: 8px;
  }

  .create-device-strip .device-button {
    width: 42px;
    height: 42px;
    border-radius: 12px;
  }

  .create-device-strip .device-button img {
    width: 26px;
    height: 26px;
  }

  .segment-table th,
  .segment-table td {
    height: 40px;
    padding: 0 8px;
  }

  .filter-panel .chip-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .filter-panel .chip {
    width: 100%;
    padding: 0 6px;
    font-size: 11.5px;
    white-space: normal;
  }

  .filter-panel .device-strip {
    display: grid;
    grid-template-columns: repeat(4, 46px);
    align-items: center;
    gap: 10px;
  }

  .device-button {
    width: 46px;
    height: 46px;
    border-radius: 14px;
  }

  .review-card {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .segment-review-card {
    padding: 14px;
    border-radius: 14px;
  }

  .segment-review-head {
    display: grid;
    gap: 2px;
  }

  .bipolar-row {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 8px 0;
    border-bottom: 1px solid #eef1f7;
  }

  .bipolar-row:last-child {
    border-bottom: 0;
  }

  .positive-label {
    text-align: left;
  }

  .duration-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .duration-row strong {
    line-height: 1.3;
  }

  .card-list {
    padding-bottom: 92px;
  }

  .card-score strong {
    font-size: 24px;
  }

  .card-art {
    border-radius: 18px;
    font-size: 36px;
  }

  .card-title-row h2 {
    font-size: 20px;
  }

  .card-body p {
    font-size: 13px;
    line-height: 1.36;
    max-width: 100%;
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .fab {
    width: 58px;
    height: 58px;
    bottom: 92px;
  }

  .editor-toolbar,
  .commit-bar {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Device screen: mobile-app IA for per-device manual/review/AI flow. */
.device-mobile-shell {
  --device-bg: #f4f6f8;
  --device-surface: #fff;
  --device-ink: #151826;
  --device-muted: #697386;
  --device-line: #dde3ec;
  --device-blue: #3157d5;
  display: grid;
  gap: 0;
  color: var(--device-ink);
  width: 100%;
}

.shell:has(.device-mobile-shell) {
  width: min(100%, 1080px);
  max-width: 1080px;
  min-height: 100vh;
  padding: 22px 28px 108px;
  background: var(--device-bg);
}

.shell:has(.device-mobile-shell) .screen {
  gap: 0;
}

.device-titlebar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 14px;
  margin: 18px 0 14px;
}

.device-titlebar h1 {
  margin: 0;
  color: var(--device-ink);
  font-size: 25px;
  line-height: 1.1;
  font-weight: 900;
  letter-spacing: 0;
}

.device-titlebar p {
  margin: 5px 0 0;
  color: var(--device-muted);
  font-size: 13px;
  font-weight: 500;
}

.device-tabs-named {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  padding: 2px 2px 12px;
  margin: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  scrollbar-width: none;
}

.device-tabs-named::-webkit-scrollbar {
  display: none;
}

.device-named-button {
  flex: 0 0 84px;
  width: 84px;
  min-height: 96px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 6px;
  border: 1px solid var(--device-line);
  border-radius: 18px;
  background: var(--device-surface);
  color: #333b54;
  padding: 8px 6px;
  box-shadow: none;
}

.device-named-button img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.device-named-button strong {
  width: 100%;
  max-width: 70px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.1;
}

.device-named-button.is-selected {
  border-color: var(--device-blue);
  box-shadow: 0 0 0 3px rgba(49, 87, 213, 0.13);
}

.device-inner-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  padding: 6px;
  border-radius: 16px;
  background: #e9edf5;
  margin: 0 0 12px;
}

.device-inner-tabs button {
  flex: 1 1 0;
  min-width: 0;
  min-height: 42px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #5f6b82;
  font-weight: 900;
  font-size: 13px;
  white-space: nowrap;
}

.device-inner-tabs button.is-active {
  background: #fff;
  color: var(--device-blue);
  box-shadow: 0 3px 10px rgba(30, 42, 78, 0.08);
}

.device-overview-card,
.device-manual-head,
.device-links-card,
.device-ai-context,
.device-chat-input,
.device-task-card,
.device-empty-card,
.manual-toc-item,
.device-review-card {
  border-radius: 22px;
  padding: 18px;
  background: var(--device-surface);
  border: 1px solid var(--device-line);
  box-shadow: 0 8px 24px rgba(31, 42, 68, 0.06);
}

.device-overview-card {
  margin: 0;
}

.device-overview-main {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 14px;
  align-items: center;
}

.device-overview-main > img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border: 1px solid var(--device-line);
  border-radius: 16px;
  background: #fff;
  padding: 7px;
}

.device-card-title-row,
.manual-actions,
.section-heading.compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.device-card-title-row h2,
.device-manual-head h2,
.device-links-card h2,
.device-ai-context h2,
.section-heading.compact h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.device-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.device-section-title h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.2;
  font-weight: 900;
}

.device-section-title span {
  color: var(--device-muted);
  font-size: 12px;
  font-weight: 850;
}

.device-link-grid,
.device-favorite-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.device-link-chip,
.device-favorite-list button {
  display: grid;
  gap: 3px;
  min-width: 0;
  min-height: 46px;
  border: 1px solid rgba(110, 112, 153, 0.16);
  border-radius: 14px;
  padding: 8px 10px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.62);
  text-align: left;
  text-decoration: none;
}

.device-link-chip strong,
.device-favorite-list strong {
  overflow: hidden;
  font-size: 13px;
  line-height: 1.2;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-link-chip small,
.device-favorite-list small {
  overflow: hidden;
  color: var(--device-muted);
  font-size: 11px;
  line-height: 1.25;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-overview-main p,
.device-manual-head p,
.device-links-card p,
.device-ai-context p,
.device-empty-card p,
.manual-toc-item p,
.device-review-card p {
  margin: 5px 0 0;
  color: var(--device-muted);
  line-height: 1.45;
  font-size: 13px;
  font-weight: 800;
}

.edit-icon-button,
.text-action {
  border: 1px solid var(--device-line);
  border-radius: 999px;
  background: #fff;
  color: #34405c;
  padding: 8px 10px;
  font-weight: 900;
  font-size: 12px;
}

.device-purpose-tags {
  margin-top: 13px;
}

.device-mobile-shell .static-tag {
  width: auto;
  max-width: none;
  flex: 0 0 auto;
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 900;
  background: #fff;
  white-space: nowrap;
  word-break: keep-all;
  writing-mode: horizontal-tb;
  line-height: 1;
}

.device-overview-todos {
  margin-top: 13px;
  border-top: 1px solid var(--device-line);
  padding-top: 12px;
}

.device-overview-todos h3 {
  margin: 0 0 7px;
  color: #4e5871;
  font-size: 12px;
  font-weight: 900;
}

.device-overview-todos ul {
  margin: 0;
  padding-left: 19px;
  color: #384158;
  line-height: 1.65;
  font-size: 13px;
}

.device-inline-editor {
  display: grid;
  gap: 9px;
  margin-top: 16px;
}

.device-inline-editor label {
  color: #4e5871;
  font-size: 12px;
  font-weight: 900;
}

.device-inline-editor input,
.device-inline-editor textarea,
.device-chat-input input {
  width: 100%;
  border: 1px solid var(--device-line);
  border-radius: 14px;
  background: #fbfcff;
  color: var(--device-ink);
  padding: 11px 12px;
  font-size: 13px;
}

.device-add-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
}

.device-add-row input {
  min-height: 34px;
  border-radius: 12px;
  font-size: 12px;
}

.device-add-row button {
  min-height: 34px;
  border: 1px solid rgba(82, 78, 199, 0.22);
  border-radius: 12px;
  padding: 0 12px;
  color: var(--indigo);
  background: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 900;
}

.device-add-row button:hover {
  background: var(--indigo-soft);
}

.device-quick-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.device-quick-actions button {
  min-height: 70px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  color: var(--text);
  display: grid;
  place-items: center;
  gap: 3px;
  box-shadow: 0 8px 20px rgba(31, 35, 71, 0.05);
}

.device-quick-actions strong {
  font-size: 15px;
}

.device-quick-actions span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.device-overview-list,
.device-review-area,
.manual-toc-list,
.device-chat-thread {
  display: grid;
  gap: 10px;
}

.device-task-card ul {
  margin: 0;
  padding-left: 20px;
  color: #40445f;
  line-height: 1.7;
}

.device-review-filter {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  margin: 0 -4px;
  padding: 9px 4px;
  background: rgba(244, 246, 248, 0.94);
  backdrop-filter: blur(14px);
  scrollbar-width: none;
}

.device-review-filter::-webkit-scrollbar {
  display: none;
}

.device-review-list {
  display: grid;
  gap: 10px;
}

.device-review-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

.device-review-card h3,
.manual-toc-item h3,
.device-empty-card h3 {
  margin: 0;
}

.device-review-card > strong {
  color: #0b8b7f;
  font-size: 22px;
}

.device-manual-head {
  display: grid;
  gap: 14px;
}

.manual-reader-shell {
  display: grid;
  grid-template-columns: 1fr;
}

.manual-file-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  overflow: visible;
  margin: -2px 0 12px;
  padding: 8px 2px 10px;
}

.manual-file-strip button {
  flex: 0 1 168px;
  min-width: 148px;
  max-width: 190px;
  min-height: 38px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--device-line);
  border-radius: 12px;
  background: #fff;
  color: var(--device-ink);
  padding: 7px 10px;
  text-align: left;
}

.manual-file-strip button.is-selected {
  border-color: var(--device-blue);
  box-shadow: 0 0 0 3px rgba(49, 87, 213, 0.12);
}

.manual-file-strip strong {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 12px;
}

.manual-file-strip small {
  color: var(--device-muted);
  font-size: 10px;
  font-weight: 900;
}

.manual-source-panel,
.manual-toc-panel,
.manual-preview-panel {
  border-radius: 22px;
  padding: 18px;
  background: var(--device-surface);
  border: 1px solid var(--device-line);
  box-shadow: 0 8px 24px rgba(31, 42, 68, 0.06);
}

.manual-source-panel {
  grid-column: 1;
  position: static;
  display: grid;
  gap: 14px;
}

.manual-source-panel h2,
.manual-toc-header h2 {
  margin: 0;
  color: var(--device-ink);
  font-size: 20px;
  line-height: 1.2;
}

.manual-source-panel p,
.manual-toc-header p {
  margin: 5px 0 0;
  color: var(--device-muted);
  font-size: 13px;
  line-height: 1.45;
}

.manual-source-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.manual-source-actions a,
.manual-source-actions button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--device-line);
  border-radius: 14px;
  background: #fff;
  color: var(--device-ink);
  text-decoration: none;
  font-size: 13px;
  font-weight: 900;
}

.manual-source-actions button:first-child {
  border-color: var(--device-blue);
  background: var(--device-blue);
  color: #fff;
}

.manual-source-actions button:disabled {
  color: #697386;
  background: #f8fafc;
}

.manual-source-list {
  display: grid;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--device-line);
}

.manual-source-list button {
  width: 100%;
  display: grid;
  gap: 3px;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid rgba(221, 227, 236, 0.7);
  background: transparent;
  color: var(--device-ink);
  text-align: left;
}

.manual-source-list button:last-child {
  border-bottom: 0;
}

.manual-source-list button.is-selected strong {
  color: var(--device-blue);
}

.manual-source-list strong {
  font-size: 13px;
}

.manual-source-list small {
  color: var(--device-muted);
  font-size: 12px;
}

.manual-toc-panel {
  grid-column: 1;
  grid-row: 1;
  display: grid;
  gap: 12px;
}

.manual-toc-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--device-line);
}

.manual-toc-header span {
  flex: 0 0 auto;
  border: 1px solid var(--device-line);
  border-radius: 999px;
  padding: 6px 9px;
  color: #4d5871;
  font-size: 12px;
  font-weight: 900;
}

.manual-toc-rows {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: manual-toc;
}

.manual-toc-rows li {
  counter-increment: manual-toc;
}

.manual-toc-rows button {
  width: 100%;
  min-height: 56px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px 0;
  border: 0;
  border-bottom: 1px solid rgba(221, 227, 236, 0.85);
  background: transparent;
  color: var(--device-ink);
  text-align: left;
}

.manual-toc-rows li:last-child button {
  border-bottom: 0;
}

.manual-toc-rows button::before {
  content: counter(manual-toc, decimal-leading-zero);
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #eef2ff;
  color: var(--device-blue);
  font-size: 13px;
  font-weight: 950;
}

.manual-toc-rows strong {
  display: block;
  color: var(--device-ink);
  font-size: 15px;
  line-height: 1.25;
  word-break: keep-all;
}

.manual-toc-rows small {
  display: block;
  margin-top: 3px;
  color: var(--device-muted);
  font-size: 12px;
  line-height: 1.35;
}

.manual-toc-rows em {
  color: #6b7190;
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.manual-preview-panel {
  min-height: 680px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
}

.manual-preview-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--device-line);
}

.manual-preview-header h2 {
  margin: 0;
  color: var(--device-ink);
  font-size: 18px;
  line-height: 1.25;
}

.manual-preview-header p {
  margin: 4px 0 0;
  color: var(--device-muted);
  font-size: 12px;
}

.manual-preview-frame {
  width: 100%;
  height: 100%;
  min-height: 600px;
  border: 1px solid var(--device-line);
  border-radius: 14px;
  background: #fff;
}

.manual-pdf-canvas-viewer {
  width: 100%;
  min-height: 620px;
  max-height: 74vh;
  overflow: auto;
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--device-line);
  border-radius: 14px;
  background: #f1f3f7;
}

.manual-pdf-canvas-viewer p {
  margin: 0;
  color: var(--device-muted);
  align-self: start;
  justify-self: start;
}

.manual-pdf-page {
  display: block;
  max-width: 100%;
  background: #fff;
}

.manual-pdf-page-wrap {
  position: relative;
  max-width: 100%;
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.12);
}

.manual-pdf-text-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  line-height: 1;
  text-align: left;
  pointer-events: auto;
  user-select: text;
  -webkit-user-select: text;
  transform-origin: 0 0;
}

.manual-pdf-text-layer span {
  position: absolute;
  color: transparent;
  white-space: pre;
  cursor: text;
  transform-origin: 0 0;
}

.manual-pdf-text-layer br,
.manual-pdf-text-layer .endOfContent {
  display: none;
}

.manual-pdf-text-layer ::selection {
  background: rgba(49, 87, 213, 0.28);
}

.manual-reader-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.manual-reader-actions button,
.manual-reader-actions span {
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--device-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--device-ink);
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
}

.manual-reader-actions button {
  cursor: pointer;
}

.manual-reader-actions button:first-child {
  border-color: rgba(49, 87, 213, 0.45);
  color: #3157d5;
}

.manual-reader-actions button.is-active {
  border-color: transparent;
  background: #3157d5;
  color: #fff;
  box-shadow: 0 12px 28px rgba(49, 87, 213, 0.22);
}

.manual-reader-actions span {
  display: inline-flex;
  align-items: center;
  color: var(--device-muted);
}

.manual-pdf-more {
  min-height: 42px;
  border: 1px solid var(--device-line);
  border-radius: 14px;
  background: #fff;
  color: var(--device-blue);
  padding: 0 14px;
  font-weight: 900;
}

.manual-preview-text {
  min-height: 600px;
  overflow: auto;
  border: 1px solid var(--device-line);
  border-radius: 14px;
  background: #fbfcff;
}

.manual-preview-text.is-markdown {
  background: #fff;
}

.manual-preview-text pre {
  margin: 0;
  padding: 14px;
  color: #22283a;
  font-family: "Pretendard", "Noto Sans KR", system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: keep-all;
}

.manual-md-document {
  max-width: 860px;
  margin: 0 auto;
  padding: 30px clamp(18px, 4vw, 54px) 56px;
  color: #182036;
  font-size: 15px;
  line-height: 1.72;
  word-break: keep-all;
}

.manual-md-document h1,
.manual-md-document h2,
.manual-md-document h3,
.manual-md-document h4 {
  margin: 1.45em 0 0.6em;
  color: #11182d;
  line-height: 1.25;
  font-weight: 950;
}

.manual-md-document h1 {
  margin-top: 0;
  font-size: 30px;
}

.manual-md-document h2 {
  font-size: 24px;
  border-bottom: 1px solid #dde4f0;
  padding-bottom: 10px;
}

.manual-md-document h3 {
  font-size: 20px;
}

.manual-md-document h4 {
  font-size: 17px;
}

.manual-md-document p {
  margin: 0 0 0.85em;
}

.manual-md-document ul {
  margin: 0 0 1em;
  padding-left: 1.25em;
}

.manual-md-document li {
  margin: 0.35em 0;
}

.manual-md-document strong {
  font-weight: 950;
}

.manual-md-document em {
  color: #4e5870;
}

.manual-md-document code {
  border-radius: 6px;
  background: #eef3ff;
  color: #3157d5;
  padding: 0.1em 0.35em;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.9em;
}

.manual-preview-text button,
.manual-preview-unavailable {
  width: 100%;
  min-height: 160px;
  border: 0;
  background: transparent;
  color: var(--device-muted);
  padding: 20px;
  text-align: left;
}

.manual-preview-unavailable strong {
  color: var(--device-ink);
}

.compact-link {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  padding: 0 13px;
  font-size: 12px;
}

.manual-toc-item {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 12px;
  align-items: start;
}

.manual-toc-item > span {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: #eef0ff;
  color: var(--primary);
  font-weight: 950;
}

.manual-toc-item small {
  color: var(--muted);
  font-weight: 900;
}

.device-link-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
}

.device-link-row span {
  display: grid;
  gap: 3px;
}

.device-link-row small {
  color: var(--muted);
}

.ai-source-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 13px;
}

.ai-source-list span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 7px 10px;
  color: #555d74;
  font-size: 12px;
  font-weight: 900;
}

.device-chat-bubble {
  max-width: 86%;
  border-radius: 18px;
  padding: 12px 14px;
  line-height: 1.5;
}

.device-chat-bubble.assistant {
  justify-self: start;
  background: #fff;
  border: 1px solid var(--line);
}

.device-chat-bubble.user {
  justify-self: end;
  background: var(--primary);
  color: #fff;
}

.device-chat-input {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
}

.device-chat-input button {
  border: 0;
  border-radius: 15px;
  background: var(--primary);
  color: #fff;
  padding: 0 16px;
  font-weight: 900;
}

@media (max-width: 720px) {
  .device-inner-tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    padding: 5px;
    border-radius: 14px;
  }

  .device-inner-tabs button {
    flex: 1 1 0;
    min-height: 38px;
    border-radius: 10px;
    font-size: 12px;
    padding: 0 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .device-named-button {
    flex-basis: 68px;
  }

  .device-overview-main {
    grid-template-columns: 62px 1fr;
  }

  .device-link-grid,
  .device-favorite-list {
    grid-template-columns: 1fr;
  }

  .device-overview-main > img {
    width: 62px;
    height: 62px;
  }

  .manual-toc-item {
    grid-template-columns: 34px 1fr;
  }

  .manual-toc-item small {
    grid-column: 2;
  }

  .manual-preview-panel {
    min-height: 420px;
  }

  .manual-preview-frame,
  .manual-preview-text,
  .manual-pdf-canvas-viewer {
    min-height: 360px;
  }

}

@media (min-width: 760px) {
  .device-mobile-shell {
    max-width: none;
  }

  .device-tabs-named {
    gap: 12px;
  }

  .device-inner-tabs {
    margin-top: 2px;
  }

  .device-overview-card {
    max-width: none;
  }
}

/* Final create-review overrides: keep review controls off native/form styling. */
.create-screen .segment-review-card {
  border: 1px solid #e2e6ef;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 24px rgba(20, 24, 44, 0.06);
}

.create-screen .bipolar-cells button {
  appearance: none;
  border: 0;
  border-radius: 8px;
}

.create-screen .duration-options button {
  appearance: none;
  min-width: 42px;
  height: 30px;
  border: 1px solid #dfe3ee;
  border-radius: 10px;
  color: #515978;
  background: #fff;
  font-size: 12px;
  font-weight: 760;
}

.create-screen .duration-options button.is-selected {
  border-color: #4b46db;
  color: #fff;
  background: #4b46db;
  box-shadow: 0 6px 14px rgba(75, 70, 219, 0.18);
}

/* Device detail final overrides: reader-first manual view and tap-based editing. */
.device-card-title-row {
  align-items: center;
}

.edit-icon-button {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #98a2b3;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  box-shadow: none;
}

.edit-icon-button:hover {
  color: #667085;
  background: transparent;
}

.device-purpose-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.device-purpose-picker button {
  min-height: 34px;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: #fff;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 850;
}

.device-purpose-picker .indigo,
.device-purpose-picker .violet {
  color: var(--device-blue);
}

.device-purpose-picker .orange {
  color: var(--orange);
}

.device-purpose-picker .brown {
  color: var(--brown);
}

.device-purpose-picker button.is-selected {
  color: #fff;
  border-color: var(--device-blue);
  background: var(--device-blue);
}

.device-todo-checklist {
  display: grid;
  gap: 4px;
}

.device-todo-checklist button {
  min-height: 30px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: #384158;
  padding: 0;
  text-align: left;
}

.device-todo-checklist button span {
  width: 16px;
  height: 16px;
  border: 1px solid #cfd8e6;
  border-radius: 5px;
  background: #fff;
}

.device-todo-checklist button.is-checked span {
  border-color: var(--device-blue);
  background: var(--device-blue);
  box-shadow: inset 0 0 0 4px #fff;
}

/* Create screen: compact category icon picker. */
.dot-category-picker {
  display: grid;
  grid-template-columns: auto 1px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.create-picker .purpose-row,
.recommendation-situation.purpose-row {
  grid-template-columns: 118px minmax(0, 1fr);
}

.dot-category-icons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dot-category-divider {
  align-self: stretch;
  min-height: 34px;
  background: rgba(110, 112, 153, 0.22);
}

.dot-category-button {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border: 3px solid #fff;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--indigo);
  box-shadow: 0 8px 18px rgba(45, 43, 82, 0.10);
  padding: 0;
}

.dot-category-button img {
  display: block;
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.dot-category-button.meditation {
  color: #d84c7f;
}

.dot-category-button.daily {
  color: #d9852f;
}

.dot-category-button.phase {
  color: var(--violet);
}

.dot-category-button.is-active {
  background: #fff;
  box-shadow: 0 0 0 2px currentColor, 0 10px 22px rgba(45, 43, 82, 0.14);
}

.dot-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  min-width: 0;
}

.segment-device-strip {
  padding: 0 0 10px;
}

.review-note-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.review-note-grid label,
.review-text-feedback {
  display: grid;
  gap: 5px;
}

.review-note-grid span,
.review-text-feedback span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.review-note-grid textarea,
.review-text-feedback textarea {
  width: 100%;
  min-height: 54px;
  border: 1px solid rgba(110, 112, 153, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  padding: 9px 10px;
  font: 760 13px/1.35 inherit;
  resize: vertical;
}

.review-text-feedback {
  margin-top: 10px;
}

.device-todo-checklist button strong {
  font-size: 14px;
  font-weight: 760;
  line-height: 1.35;
}

.device-empty-inline {
  color: var(--device-muted);
  font-size: 13px;
  font-weight: 800;
}

.device-ai-hover-shell {
  width: min(720px, 100%);
  outline: 0;
}

.device-ai-hover-trigger {
  display: none;
}

.device-ai-hover-trigger strong {
  color: var(--device-ink);
  font-size: 15px;
  font-weight: 900;
}

.device-ai-hover-trigger span {
  color: var(--device-muted);
  font-size: 12px;
  font-weight: 800;
}

.device-ai-hover-panel {
  width: 100%;
  display: grid;
  gap: 10px;
}

.device-ai-hover-panel .device-chat-thread {
  max-height: min(420px, 48vh);
  overflow: auto;
}

.manual-preview-panel {
  position: relative;
}

.manual-preview-header {
  align-items: center;
}

.manual-toc-trigger {
  flex: 0 0 auto;
  min-height: 38px;
  border: 1px solid var(--device-line);
  border-radius: 14px;
  background: #fff;
  color: var(--device-blue);
  padding: 0 13px;
  font-size: 13px;
  font-weight: 900;
}

.manual-toc-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(15, 23, 42, 0.16);
}

.manual-derived-toc {
  position: absolute;
  top: 72px;
  right: 18px;
  z-index: 260;
  width: min(380px, calc(100% - 36px));
  max-height: min(440px, calc(100vh - 260px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  overflow: hidden;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--device-line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 18px 54px rgba(24, 32, 56, 0.18);
}

.manual-toc-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--device-line);
}

.manual-toc-title h3 {
  margin: 0;
  color: var(--device-ink);
  font-size: 18px;
  font-weight: 900;
}

.manual-toc-title button {
  border: 0;
  background: transparent;
  color: #667085;
  font-size: 12px;
  font-weight: 900;
}

.manual-toc-list {
  min-height: 0;
  display: grid;
  gap: 2px;
  overflow: auto;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: #aab4c5 transparent;
}

.manual-toc-list::-webkit-scrollbar {
  width: 8px;
}

.manual-toc-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #aab4c5;
}

.manual-toc-list::-webkit-scrollbar-track {
  background: transparent;
}

.manual-toc-list button {
  width: 100%;
  min-height: 46px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--device-ink);
  padding: 0 8px;
  text-align: left;
}

.manual-toc-list button:hover {
  background: #eef3ff;
}

.manual-toc-list button span {
  color: var(--device-blue);
  font-size: 12px;
  font-weight: 950;
}

.manual-toc-list button strong {
  overflow: hidden;
  font-size: 14px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manual-ai-backdrop {
  position: absolute;
  inset: 0;
  z-index: 250;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(248, 250, 252, 0.08), rgba(15, 23, 42, 0.10));
}

.manual-ai-overlay {
  position: absolute;
  top: 78px;
  right: 18px;
  z-index: 270;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(420px, calc(100% - 36px));
  min-height: min(560px, calc(100vh - 250px));
  max-height: min(620px, calc(100vh - 230px));
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(209, 216, 229, 0.96);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 26px 70px rgba(15, 23, 42, 0.22);
  backdrop-filter: blur(18px);
}

.manual-ai-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid rgba(218, 224, 235, 0.88);
}

.manual-ai-head div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.manual-ai-head strong {
  color: var(--device-ink);
  font-size: 17px;
  line-height: 1.2;
}

.manual-ai-head span {
  color: var(--device-muted);
  font-size: 12px;
  font-weight: 700;
}

.manual-ai-head button {
  border: 0;
  background: transparent;
  color: var(--device-muted);
  font-weight: 900;
  cursor: pointer;
}

.manual-ai-overlay .device-chat-thread {
  min-height: 0;
  max-height: min(430px, calc(100vh - 360px));
  padding: 18px;
  overflow: auto;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.84), rgba(255, 255, 255, 0.96));
}

.manual-ai-overlay .device-chat-input {
  padding: 14px;
  border-top: 1px solid rgba(218, 224, 235, 0.88);
  background: #fff;
}

.manual-preview-panel.is-reader {
  min-height: min(780px, calc(100vh - 250px));
}

.manual-pdf-canvas-viewer {
  min-height: min(700px, calc(100vh - 330px));
  max-height: calc(100vh - 330px);
  padding-bottom: 100px;
}

@media (max-width: 1180px) {
  .shell:has(.device-mobile-shell) {
    max-width: none;
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
  }

  .device-mobile-shell:has(.manual-reader-shell) .manual-reader-shell {
    width: calc(100vw - 20px);
    margin-left: calc(50% - 50vw + 10px);
    margin-right: calc(50% - 50vw + 10px);
  }

  .device-mobile-shell:has(.manual-reader-shell) .manual-preview-panel.is-reader {
    border-radius: 18px;
    padding: 10px;
  }

  .device-mobile-shell:has(.manual-reader-shell) .manual-pdf-canvas-viewer {
    padding: 6px;
    padding-bottom: 96px;
    border-radius: 12px;
  }
}

@media (max-width: 720px) {
  .shell:has(.device-mobile-shell) {
    padding-left: max(6px, env(safe-area-inset-left));
    padding-right: max(6px, env(safe-area-inset-right));
  }

  .device-mobile-shell:has(.manual-reader-shell) .manual-reader-shell {
    width: calc(100vw - 12px);
    margin-left: calc(50% - 50vw + 6px);
    margin-right: calc(50% - 50vw + 6px);
  }

  .device-mobile-shell:has(.manual-reader-shell) .manual-preview-panel.is-reader {
    padding: 6px;
    border-radius: 14px;
    gap: 6px;
  }

  .device-mobile-shell:has(.manual-reader-shell) .manual-pdf-canvas-viewer {
    padding: 4px;
    padding-bottom: 92px;
    border-radius: 10px;
  }

  .manual-derived-toc {
    position: fixed;
    left: 12px;
    right: 12px;
    top: auto;
    bottom: 88px;
    width: auto;
    max-height: 56vh;
    border-radius: 22px;
  }

  .manual-ai-backdrop {
    position: fixed;
    z-index: 240;
    border-radius: 0;
  }

  .manual-ai-overlay {
    position: fixed;
    left: 12px;
    right: 12px;
    top: auto;
    bottom: 188px;
    width: auto;
    min-height: calc(100vh - 340px);
    max-height: calc(100vh - 232px);
    border-radius: 24px;
  }

  .manual-preview-panel.is-reader {
    min-height: calc(100vh - 178px);
  }

  .manual-pdf-canvas-viewer {
    min-height: calc(100vh - 330px);
    max-height: calc(100vh - 330px);
  }

  .manual-preview-header {
    gap: 8px;
    padding-bottom: 6px;
  }

  .manual-preview-header h2 {
    font-size: 14px;
    line-height: 1.2;
  }

  .manual-preview-header p {
    margin-top: 2px;
    font-size: 10px;
  }

  .manual-reader-actions {
    gap: 6px;
  }

  .manual-reader-actions button,
  .manual-reader-actions span {
    min-height: 30px;
    padding: 0 11px;
    font-size: 12px;
  }

  .manual-preview-frame {
    min-height: calc(100vh - 260px);
    border-radius: 10px;
  }
}
