:root {
  --bg: #090b0f;
  --screen: #14161b;
  --panel: #1b1e24;
  --panel-2: #20242b;
  --ink: #eef2f5;
  --muted: #9aa2af;
  --line: #262a31;
  --teal: #119c9b;
  --teal-2: #24c8c2;
  --red: #ef4444;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft YaHei", Arial, sans-serif;
  background: #050607;
  color: var(--ink);
}

.child-login {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: #101217;
}

.child-login.hidden { display: none; }

.child-login-panel {
  width: min(100%, 430px);
  padding: 24px;
  border-radius: 8px;
  background: #191c22;
  color: #f5f7fb;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
}

.child-login-panel > span { color: #24c8c2; font-weight: 800; }
.child-login-panel h1 { margin: 8px 0; font-size: 30px; }
.child-login-panel p,
.child-login-panel small { color: #9ba4b5; line-height: 1.5; }
.child-login-panel label { display: grid; gap: 7px; margin-top: 16px; font-weight: 800; }
.child-login-panel input {
  width: 100%;
  min-height: 50px;
  border: 1px solid #343a45;
  border-radius: 6px;
  padding: 0 14px;
  background: #101217;
  color: #fff;
  font-size: 18px;
}

.demo-account-card {
  display: grid;
  gap: 4px;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid rgba(36, 200, 194, 0.3);
  border-radius: 8px;
  background: rgba(17, 156, 155, 0.1);
}

.demo-account-card strong { font-size: 21px; }
.demo-account-card span { color: #9ba4b5; }

.login-code-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
.login-code-row button,
.login-primary {
  min-height: 50px;
  border: 0;
  border-radius: 999px;
  padding: 0 18px;
  background: #119c9b;
  color: #062021;
  font-weight: 900;
}
.login-primary { width: 100%; margin: 18px 0 10px; }

.family-invite-card {
  margin-top: 14px;
  padding: 14px;
  border-radius: 8px;
  background: var(--panel);
}

.family-invite-card p { color: var(--muted); line-height: 1.45; }
.invite-code-box {
  margin: 12px 0;
  min-height: 58px;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(36, 200, 194, 0.5);
  border-radius: 6px;
  color: var(--teal-2);
  font-size: 24px;
  font-weight: 900;
}
.family-invite-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.family-invite-actions button,
.logout-button {
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  background: var(--teal);
  color: #062021;
  font-weight: 900;
}
.family-invite-actions button.ghost { background: rgba(17, 156, 155, 0.18); color: #dffefa; }
.logout-button { width: 100%; margin-top: 10px; background: transparent; color: var(--muted); }
.login-security-state {
  margin-top: 12px;
  padding: 10px 12px;
  border-left: 3px solid var(--teal);
  background: rgba(17, 156, 155, 0.08);
  color: var(--muted);
  line-height: 1.45;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.phone-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(circle at 50% 0%, rgba(36, 200, 194, 0.16), transparent 34%),
    var(--bg);
}

.phone-screen {
  width: min(430px, 100%);
  min-height: 860px;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  scrollbar-width: none;
  background: var(--screen);
  border: 10px solid #06070a;
  border-radius: 34px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
  padding: 18px 16px 96px;
  position: relative;
}

.phone-screen::-webkit-scrollbar {
  display: none;
}

.status-bar {
  height: 38px;
  display: grid;
  grid-template-columns: 70px 1fr 76px;
  align-items: center;
  color: #fff;
}

.status-bar strong {
  font-size: 22px;
}

.status-bar span {
  text-align: right;
  font-weight: 800;
}

.dynamic-island {
  justify-self: center;
  width: 154px;
  height: 38px;
  border-radius: 999px;
  background: #000;
}

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

.app-header p {
  color: var(--muted);
  margin: 0 0 4px;
}

.app-header h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.2;
}

#deviceStatus {
  border-radius: 999px;
  color: #dffefa;
  background: rgba(17, 156, 155, 0.18);
  padding: 8px 12px;
  white-space: nowrap;
}

#deviceStatus.offline {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.2);
}

.tabs {
  display: flex;
  justify-content: center;
  gap: 34px;
  border-bottom: 1px solid var(--line);
  margin: 4px -16px 16px;
  padding-bottom: 12px;
}

.tabs button,
.bottom-nav button {
  border: 0;
  background: transparent;
  color: #78808c;
  font-weight: 800;
  font-size: 18px;
  padding: 8px 0;
}

.tabs button.active {
  color: var(--ink);
  border-bottom: 4px solid var(--teal-2);
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.hero-status {
  min-height: 170px;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0.72)),
    url("./assets/images/family_photo.svg") center/cover;
  color: #fff;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: end;
}

.hero-status p,
.hero-status span {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
}

.hero-status strong {
  display: block;
  margin: 8px 0;
  font-size: 32px;
  line-height: 1.1;
}

.signal {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0 18%, rgba(255, 255, 255, 0.28) 19% 44%, rgba(255, 255, 255, 0.12) 45%);
  flex: 0 0 auto;
}

.safety-alert {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid rgba(239, 68, 68, 0.45);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.22), rgba(32, 36, 43, 0.96));
  margin-top: 14px;
  padding: 14px;
  box-shadow: 0 12px 24px rgba(239, 68, 68, 0.12);
}

.safety-alert.low {
  border-color: rgba(17, 156, 155, 0.42);
  background: linear-gradient(135deg, rgba(17, 156, 155, 0.22), rgba(32, 36, 43, 0.96));
  box-shadow: 0 12px 24px rgba(17, 156, 155, 0.12);
}

.safety-alert.medium {
  border-color: rgba(245, 158, 11, 0.5);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.24), rgba(32, 36, 43, 0.96));
  box-shadow: 0 12px 24px rgba(245, 158, 11, 0.12);
}

.safety-alert.high {
  border-color: rgba(239, 68, 68, 0.64);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.3), rgba(32, 36, 43, 0.96));
  box-shadow: 0 12px 24px rgba(239, 68, 68, 0.18);
}

.safety-alert.hidden {
  display: none;
}

.safety-alert span,
.safety-alert p {
  color: rgba(255, 255, 255, 0.74);
}

.safety-alert span {
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
}

.safety-alert strong {
  display: block;
  font-size: 20px;
}

.safety-alert p {
  margin: 6px 0 0;
  line-height: 1.45;
}

.safety-alert button {
  border: 0;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font: inherit;
  font-weight: 900;
  padding: 10px 14px;
  white-space: nowrap;
}

.safety-alert.low button {
  background: var(--teal);
}

.safety-alert.medium button {
  background: #f59e0b;
}

.safety-alert.high button {
  background: #ef4444;
}

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

.quick-grid button,
.action-list button {
  min-height: 94px;
  border: 0;
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 14px;
  text-align: left;
}

.quick-grid strong,
.quick-grid span {
  display: block;
}

.quick-grid strong {
  font-size: 20px;
  margin-bottom: 8px;
}

.quick-grid span {
  color: var(--muted);
  line-height: 1.35;
}

.feed-section {
  margin-top: 18px;
}

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

.section-title span,
.card-title span {
  color: var(--muted);
}

.feed-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.feed-card,
.card,
.compose-card,
.interaction-card,
.profile-card,
.member-card {
  border-radius: 8px;
  background: var(--panel);
  padding: 14px;
}

.feed-card.wide {
  grid-column: span 2;
}

.feed-image {
  height: 150px;
  border-radius: 8px;
  margin: -4px -4px 12px;
}

.feed-image.opera {
  background: url("./assets/images/opera_stage.svg") center/cover;
}

.feed-image.call {
  background: url("./assets/images/family_photo.svg") center/cover;
}

.feed-image.reminder {
  background: linear-gradient(135deg, #119c9b, #20323a);
}

.feed-card strong,
.card strong {
  display: block;
  font-size: 18px;
}

.feed-card p,
.card p,
.compose-card p,
.member-card span,
.profile-card p,
.platform-list span {
  color: var(--muted);
  line-height: 1.45;
  margin-bottom: 0;
}

.compose-card .label {
  color: var(--teal-2);
  font-weight: 800;
}

.compose-card h2,
.profile-card h2 {
  margin: 0 0 8px;
}

.compose-preview {
  height: 230px;
  border-radius: 8px;
  background: url("./assets/images/family_photo.svg") center/cover;
  display: grid;
  place-items: end center;
  padding-bottom: 22px;
  color: #fff;
  font-weight: 800;
  margin-top: 12px;
}

.action-list,
.platform-list,
.setting-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.interaction-card {
  margin-top: 14px;
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline div {
  border-left: 3px solid var(--teal);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 0 8px 8px 0;
  padding: 10px 12px;
}

.timeline strong,
.timeline span {
  display: block;
}

.timeline strong {
  color: var(--ink);
  font-size: 17px;
}

.timeline span {
  color: var(--muted);
  line-height: 1.4;
  margin-top: 4px;
}

.notification-center {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.notification-item {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
}

.notification-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(17, 156, 155, 0.18);
  color: #dffefa;
  font-weight: 900;
}

.notification-item strong,
.notification-item span,
.notification-item small {
  display: block;
}

.notification-item strong {
  font-size: 17px;
}

.notification-item span {
  color: var(--muted);
  line-height: 1.45;
  margin-top: 4px;
}

.notification-item small {
  color: rgba(255, 255, 255, 0.52);
  margin-top: 8px;
}

.notification-item.low {
  border-left: 3px solid var(--teal);
}

.notification-item.medium {
  border-left: 3px solid #f59e0b;
}

.notification-item.high {
  border-left: 3px solid #ef4444;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.16), var(--panel));
}

.notification-item.reminder {
  border-left: 3px solid #f59e0b;
}

.notification-item.device {
  border-left: 3px solid #64748b;
}

.notification-empty {
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  padding: 16px;
  line-height: 1.45;
}

.phrase-form {
  display: grid;
  grid-template-columns: 1fr 120px auto;
  gap: 10px;
  margin-top: 12px;
}

.phrase-form input,
.phrase-form select {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #0f1116;
  color: var(--ink);
  padding: 10px 12px;
}

.phrase-form button {
  border: 0;
  border-radius: 999px;
  background: var(--teal);
  color: #fff;
  font-weight: 900;
  padding: 10px 14px;
}

.phrase-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.phrase-list article {
  border-left: 3px solid var(--teal);
  border-radius: 0 8px 8px 0;
  background: rgba(255, 255, 255, 0.04);
  padding: 10px 12px;
}

.phrase-list strong,
.phrase-list span {
  display: block;
}

.phrase-list span {
  color: var(--muted);
  margin-top: 4px;
}

.platform-list div {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.platform-manager {
  display: grid;
  gap: 14px;
  margin: 14px 0;
}

.platform-group {
  border-radius: 8px;
  background: var(--panel);
  padding: 14px;
}

.platform-group-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.platform-group-title strong,
.platform-group-title span {
  display: block;
}

.platform-group-title strong {
  font-size: 22px;
}

.platform-group-title span {
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.35;
}

.platform-group-title button,
.platform-source-card button {
  border: 0;
  border-radius: 999px;
  background: rgba(17, 156, 155, 0.18);
  color: #dffefa;
  padding: 8px 12px;
  font-weight: 800;
  white-space: nowrap;
}

.platform-source-list {
  display: grid;
  gap: 10px;
}

.platform-source-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.platform-source-card strong,
.platform-source-card p {
  display: block;
}

.platform-source-card strong {
  margin-top: 8px;
}

.platform-source-card p {
  color: var(--muted);
  line-height: 1.45;
  margin: 5px 0 0;
}

.platform-badge {
  display: inline-block;
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 13px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.platform-badge.local {
  background: rgba(17, 156, 155, 0.18);
  color: #dffefa;
}

.platform-badge.external {
  background: rgba(36, 200, 194, 0.22);
  color: #bffffb;
}

.platform-badge.placeholder {
  background: rgba(255, 255, 255, 0.1);
  color: #c4cad4;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.tag-row button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 9px 12px;
}

.tag-row button.selected {
  background: rgba(17, 156, 155, 0.18);
  border-color: var(--teal);
  color: #dffefa;
}

.wide-action {
  width: 100%;
  border: 0;
  border-radius: 999px;
  background: var(--teal);
  color: #fff;
  font-weight: 900;
  padding: 13px 16px;
  margin-top: 12px;
}

.wide-action.ghost {
  background: rgba(17, 156, 155, 0.18);
  color: #dffefa;
}

.profile-card {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 14px;
  align-items: center;
}

.avatar-box {
  width: 76px;
  height: 76px;
  border-radius: 8px;
  background: linear-gradient(135deg, #119c9b, #20323a);
  display: grid;
  place-items: center;
  font-size: 32px;
  font-weight: 900;
}

.member-card {
  margin-top: 14px;
  background: linear-gradient(135deg, #0f9e9b, #21c5bd);
  color: #fff;
}

.member-card button {
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: var(--teal);
  font-weight: 900;
  padding: 8px 14px;
  margin-top: 12px;
}

.device-bind-card {
  border-radius: 8px;
  background: var(--panel);
  padding: 14px;
  margin-top: 14px;
}

.device-bind-card p,
.device-bind-card small {
  color: var(--muted);
  line-height: 1.45;
}

.pairing-code-box {
  margin: 12px 0;
  min-height: 66px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(36, 200, 194, 0.32);
  border-radius: 8px;
  background: rgba(17, 156, 155, 0.12);
  color: var(--teal-2);
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 0;
}

.device-bind-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.device-bind-actions button {
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  background: var(--teal);
  color: #062021;
  font-weight: 900;
}

.device-bind-actions button.ghost {
  background: rgba(17, 156, 155, 0.18);
  color: #dffefa;
}

.family-overview-card {
  margin-top: 14px;
  padding: 14px;
  border-radius: 8px;
  background: var(--panel);
}

.family-overview-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.family-overview-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
}

.family-overview-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(17, 156, 155, 0.18);
  color: var(--teal-2);
  font-weight: 900;
}

.family-overview-item strong,
.family-overview-item span { display: block; }

.family-overview-item span,
.family-overview-item small { color: var(--muted); }

.family-overview-item .online { color: var(--teal-2); }

.family-member-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.family-member-actions button {
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  padding: 0 10px;
  background: rgba(17, 156, 155, 0.18);
  color: #dffefa;
  font-weight: 800;
}

.family-member-actions button.danger { color: #ff9f9f; background: rgba(216, 74, 74, 0.13); }

.family-audit-card {
  margin-top: 14px;
  padding: 14px;
  border-radius: 8px;
  background: var(--panel);
}

.family-audit-list { display: grid; gap: 8px; margin-top: 12px; }
.family-audit-item { padding: 10px 0; border-bottom: 1px solid var(--line); }
.family-audit-item strong,
.family-audit-item span { display: block; }
.family-audit-item span,
.family-audit-item small { margin-top: 4px; color: var(--muted); }

.family-overview-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 14px;
}

.family-overview-actions button {
  min-height: 46px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--teal);
  color: #062021;
  font-weight: 900;
}

.family-overview-actions button.ghost {
  background: rgba(17, 156, 155, 0.18);
  color: #dffefa;
}

.setting-list button {
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 18px 4px;
  font-size: 20px;
}

.bottom-nav {
  position: sticky;
  bottom: -96px;
  margin: 20px -16px -96px;
  min-height: 82px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  background: rgba(20, 22, 27, 0.94);
  border-top: 1px solid var(--line);
  padding: 8px 12px;
}

.bottom-nav button.active {
  color: var(--ink);
}

.bottom-nav .plus {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  justify-self: center;
  background: var(--teal);
  color: #fff;
  font-size: 38px;
  line-height: 1;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  width: min(360px, calc(100% - 40px));
  transform: translate(-50%, 140%);
  background: rgba(0, 0, 0, 0.92);
  color: #fff;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  transition: transform 0.2s ease;
  z-index: 20;
}

.toast.show {
  transform: translate(-50%, 0);
}

.child-rtc-layer {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: 100%;
  overflow: hidden;
  background: #0a0d10;
}

.child-rtc-layer.hidden { display: none; }

.child-rtc-remote {
  min-height: 560px;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 40px 24px 150px;
  text-align: center;
  background: linear-gradient(180deg, #173432 0%, #101417 62%, #090b0f 100%);
}

.child-rtc-remote video,
.child-rtc-local video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
}

.child-call-avatar {
  width: 104px;
  height: 104px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background: #119c9b;
  color: #fff;
  font-size: 25px;
  font-weight: 900;
}

.child-rtc-remote p { margin: 24px 0 6px; color: #b9c4c7; font-size: 18px; }
.child-rtc-remote h2 { margin: 0; font-size: 34px; }
.child-rtc-remote small { margin-top: 12px; color: #8f9a9f; }
.child-rtc-remote.connected > .child-call-avatar,
.child-rtc-remote.connected > p,
.child-rtc-remote.connected > h2,
.child-rtc-remote.connected > small { display: none; }

.child-rtc-local {
  position: absolute;
  right: 18px;
  top: 82px;
  width: 112px;
  height: 154px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 2px solid #fff;
  border-radius: 8px;
  background: #30363b;
  font-weight: 900;
}

.child-rtc-actions {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 26px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  padding: 0 40px;
}

.child-rtc-actions button {
  min-height: 62px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  font-size: 18px;
  font-weight: 900;
}

.child-call-accept { background: #22a85a; }
.child-call-end { background: #db4242; }

@media (max-width: 480px) {
  .phone-shell {
    padding: 0;
  }

  .phone-screen {
    width: 100%;
    min-height: 100vh;
    max-height: none;
    border: 0;
    border-radius: 0;
  }
}
