:root {
  --bg: #faf7f2;
  --page: #efeae2;
  --surface: #ffffff;
  --surface-strong: #fff9ef;
  --border: #d8d2c8;
  --text: #1f2937;
  --muted: #64748b;
  --heading: #0f172a;
  --primary: #1e3a8a;
  --primary-soft: #eaf0ff;
  --accent: #d97706;
  --success: #166534;
  --danger: #b91c1c;
  --focus: #2563eb;
  --shadow: 0 20px 55px rgba(31, 41, 55, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--page);
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible {
  outline: 4px solid var(--focus);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -80px;
  background: var(--primary);
  color: #fff;
  padding: 12px 16px;
  z-index: 10;
}

.skip-link:focus {
  top: 16px;
}

.app-shell {
  min-height: 100vh;
  padding: 24px;
}

.app-shell[data-text-size="large"] {
  font-size: 112%;
}

.app-shell[data-text-size="xlarge"] {
  font-size: 126%;
}

.topbar {
  max-width: 1180px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-weight: 800;
  letter-spacing: 0.02em;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 3.2rem);
  color: var(--heading);
}

h2 {
  font-size: 1.55rem;
  color: var(--heading);
}

h3 {
  font-size: 1.15rem;
  color: var(--heading);
}

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

.role-button,
.icon-button,
.nav-item,
.back-button,
.secondary-action,
.toggle-button,
.segmented button {
  min-height: 48px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
}

.role-button {
  padding: 0 20px;
}

.role-button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.main-layout {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(320px, 480px) minmax(320px, 1fr);
  gap: 22px;
  align-items: start;
}

.phone-panel,
.dashboard-panel {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.phone-panel {
  min-height: 760px;
  position: relative;
  overflow: hidden;
  padding-bottom: 90px;
}

.phone-head {
  min-height: 78px;
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 2px solid var(--border);
  background: var(--surface);
}

.phone-head strong {
  display: block;
  color: var(--heading);
  font-size: 1.35rem;
}

.phone-head span {
  color: var(--muted);
  font-weight: 700;
}

.icon-button {
  padding: 0 14px;
}

.view-stack {
  position: relative;
}

.screen {
  display: none;
  padding: 22px 18px 18px;
}

.screen.active {
  display: block;
}

.hello,
.section-copy,
.safe-note {
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 700;
}

.progress-block,
.notice-box,
.record-section,
.habit-area,
.setting-list,
.message-list {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

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

.progress-meta h2 {
  margin: 0;
}

.progress-meta span {
  color: var(--primary);
  font-size: 1.1rem;
  font-weight: 900;
  white-space: nowrap;
}

.progress-bar {
  height: 18px;
  background: #e7ded0;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
  transition: width 180ms ease;
}

.primary-action,
.call-button {
  width: 100%;
  min-height: 64px;
  border: 0;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  text-decoration: none;
  font-size: 1.35rem;
  font-weight: 900;
  cursor: pointer;
}

.call-button {
  background: var(--success);
}

.secondary-action,
.back-button {
  width: 100%;
  padding: 0 16px;
  background: var(--primary-soft);
  border-color: #c8d6ff;
  color: var(--primary);
}

.back-button {
  width: auto;
  margin-bottom: 14px;
}

.mission-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.mission-card {
  width: 100%;
  min-height: 96px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  display: grid;
  grid-template-columns: 58px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 16px;
  text-align: left;
  cursor: pointer;
}

.mission-card.done {
  border-color: #9fd0aa;
  background: #eff8f1;
}

.mission-icon {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  background: var(--primary-soft);
  display: grid;
  place-items: center;
  color: var(--primary);
  font-size: 1.6rem;
  font-weight: 900;
}

.mission-title {
  display: block;
  color: var(--heading);
  font-size: 1.18rem;
  font-weight: 900;
}

.mission-desc {
  color: var(--muted);
  font-weight: 700;
}

.mission-status {
  color: var(--success);
  font-weight: 900;
}

.notice-box {
  display: none;
  background: var(--primary-soft);
  border-color: #c8d6ff;
  color: var(--primary);
  font-weight: 800;
}

.notice-box.show {
  display: block;
}

.bottom-nav {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 82px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 2px solid var(--border);
  background: var(--surface);
}

.nav-item {
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
}

.nav-item.active {
  color: var(--primary);
  background: var(--primary-soft);
}

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

.habit-button {
  min-height: 56px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  padding: 0 14px;
  font-weight: 800;
}

.habit-button.done {
  border-color: #9fd0aa;
  background: #eff8f1;
  color: var(--success);
}

.game-head {
  margin-bottom: 16px;
}

.game-head h2 {
  margin-bottom: 6px;
}

.game-head p {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 800;
}

.game-board {
  min-height: 316px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
  margin-bottom: 14px;
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(72px, 1fr));
  gap: 12px;
}

.memory-card {
  aspect-ratio: 1;
  min-height: 88px;
  border: 2px solid var(--primary);
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 2.25rem;
  font-weight: 900;
  cursor: pointer;
}

.memory-card.flipped,
.memory-card.matched {
  background: var(--surface-strong);
  color: var(--heading);
  border-color: var(--accent);
}

.memory-card.matched {
  border-color: var(--success);
  background: #eff8f1;
}

.find-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.find-cell {
  min-height: 86px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--surface-strong);
  font-size: 2rem;
  cursor: pointer;
}

.find-cell.found {
  border-color: var(--success);
  background: #eff8f1;
}

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

.pattern-tile,
.choice-button {
  min-height: 76px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--surface-strong);
  font-size: 2rem;
  font-weight: 900;
}

.choice-button {
  cursor: pointer;
}

.choice-button.correct {
  border-color: var(--success);
  background: #eff8f1;
}

.choice-button.wrong {
  border-color: var(--danger);
  background: #fff1f2;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  min-height: 94px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}

.stat-value {
  display: block;
  color: var(--primary);
  font-size: 1.55rem;
  font-weight: 900;
}

.stat-label {
  color: var(--muted);
  font-weight: 800;
}

.week-bars {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  align-items: end;
  min-height: 130px;
}

.day-bar {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 8px;
  min-width: 0;
}

.day-bar span:first-child {
  align-self: end;
  min-height: 8px;
  border-radius: 8px 8px 0 0;
  background: var(--accent);
}

.day-bar span:last-child {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
  text-align: center;
}

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

.record-item,
.message-item {
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
  font-weight: 800;
}

.message-item {
  background: var(--surface-strong);
}

.action-stack {
  display: grid;
  gap: 12px;
}

.setting-list {
  display: grid;
  gap: 12px;
}

.setting-row {
  display: grid;
  gap: 10px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.segmented button.active,
.toggle-button[aria-pressed="true"] {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.toggle-button[aria-pressed="false"] {
  background: #fff1f2;
  border-color: #fecdd3;
  color: var(--danger);
}

.safe-note {
  margin-top: 16px;
}

.dashboard-panel {
  padding: 22px;
}

.dashboard-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.dashboard-head h2 {
  margin-bottom: 0;
}

.dashboard-head span {
  color: var(--muted);
  font-weight: 800;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(30px);
  max-width: min(420px, calc(100vw - 32px));
  padding: 14px 18px;
  border-radius: 8px;
  background: var(--heading);
  color: #fff;
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 900px) {
  .app-shell {
    padding: 14px;
  }

  .topbar,
  .dashboard-head {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .main-layout {
    grid-template-columns: 1fr;
  }

  .dashboard-panel {
    display: none;
  }

  .app-shell[data-role="family"] .phone-panel {
    display: none;
  }

  .app-shell[data-role="family"] .dashboard-panel {
    display: block;
  }

  .phone-panel {
    min-height: calc(100vh - 126px);
  }

  .stat-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

/* Wireframe-inspired visual pass */
:root {
  --border: #e6e1d8;
  --muted: #6b7280;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  --radius: 18px;
}

body {
  background: var(--page);
}

.app-shell {
  padding: 0;
}

.topbar {
  max-width: none;
  margin: 0;
  padding: 14px 18px;
  background: var(--heading);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar .eyebrow,
.topbar h1 {
  color: #fff;
}

.topbar .eyebrow {
  font-size: 0.82rem;
  color: #cbd5e1;
}

.topbar h1 {
  font-size: 1.15rem;
}

.role-button {
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: #334155;
  color: #fff;
  font-size: 0.9rem;
}

.role-button.active {
  background: var(--accent);
}

.main-layout {
  max-width: 980px;
  padding: 28px 12px 60px;
  grid-template-columns: 390px 390px;
  justify-content: center;
  gap: 28px;
}

.phone-panel,
.dashboard-panel {
  width: 390px;
  max-width: 100%;
  height: 780px;
  min-height: 0;
  border: 14px solid #1f2937;
  border-radius: 46px;
  background: var(--bg);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.phone-panel {
  padding-bottom: 0;
}

.dashboard-panel {
  padding: 0 0 24px;
  overflow-y: auto;
}

.device-notch {
  position: absolute;
  top: 0;
  left: 50%;
  width: 150px;
  height: 26px;
  transform: translateX(-50%);
  border-radius: 0 0 18px 18px;
  background: #1f2937;
  z-index: 5;
}

.status-space {
  height: 30px;
  flex: none;
}

.phone-head {
  min-height: 64px;
  padding: 10px 18px 6px;
  border-bottom: 0;
  background: transparent;
}

.phone-head strong {
  font-size: 1.38rem;
  font-weight: 900;
}

.phone-head span {
  font-size: 0.92rem;
}

.icon-button {
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 14px;
  background: var(--surface);
  font-size: 1.3rem;
}

.view-stack {
  height: calc(100% - 94px);
  overflow: hidden;
}

.screen {
  height: 100%;
  overflow-y: auto;
  padding: 6px 18px 104px;
  scrollbar-width: none;
}

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

.hello,
.section-copy {
  margin: 2px 0 14px;
  font-size: 1.08rem;
  line-height: 1.55;
}

.progress-block,
.notice-box,
.record-section,
.habit-area,
.setting-list,
.message-list,
.game-board {
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--surface);
}

.progress-block {
  padding: 18px;
  margin: 6px 0 14px;
  border-color: #cdddff;
  background: var(--primary-soft);
}

.progress-meta {
  display: block;
}

.progress-meta h2 {
  margin-bottom: 8px;
  font-size: 1.1rem;
}

.progress-meta span {
  display: block;
  font-size: 1rem;
  color: var(--muted);
}

.progress-bar {
  height: 18px;
  background: #ece7dd;
}

.mission-list {
  gap: 16px;
  margin: 10px 0 16px;
}

.mission-card {
  min-height: 84px;
  grid-template-columns: 56px 1fr auto;
  gap: 16px;
  padding: 18px;
  border-radius: var(--radius);
  border-color: var(--border);
  transition: transform 120ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.mission-card:hover {
  border-color: var(--focus);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.12);
}

.mission-card:active {
  transform: scale(0.99);
}

.mission-icon {
  width: 56px;
  height: 56px;
  border-radius: 0;
  background: transparent;
  font-size: 2.45rem;
  color: inherit;
}

.mission-title {
  font-size: 1.32rem;
  line-height: 1.2;
}

.mission-desc {
  display: block;
  margin-top: 3px;
  font-size: 0.98rem;
}

.mission-status {
  min-width: 44px;
  min-height: 30px;
  display: inline-grid;
  place-items: center;
  padding: 3px 8px;
  border-radius: 8px;
  background: #e7f2ea;
  color: var(--success);
  font-size: 0.9rem;
}

.mission-card.done .mission-status {
  min-width: auto;
  background: transparent;
  font-size: 1.75rem;
}

.primary-action,
.call-button,
.secondary-action,
.back-button,
.habit-button {
  border-radius: 16px;
}

.primary-action,
.call-button {
  min-height: 60px;
  margin-bottom: 14px;
  font-size: 1.38rem;
}

.secondary-action,
.back-button {
  min-height: 54px;
  font-size: 1.05rem;
}

.bottom-nav {
  height: 78px;
  border-top: 2px solid var(--border);
}

.nav-item {
  min-height: 78px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 0.82rem;
  font-weight: 900;
}

.nav-item span {
  font-size: 1.5rem;
  line-height: 1;
}

.nav-item.active {
  background: transparent;
}

.nav-item.active span {
  transform: translateY(-1px);
}

.game-board {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.memory-grid {
  gap: 14px;
}

.memory-card {
  aspect-ratio: 3 / 4;
  min-height: 112px;
  border-radius: 14px;
  border-color: var(--border);
  font-size: 2.3rem;
}

.find-grid {
  gap: 14px;
}

.find-cell,
.pattern-tile,
.choice-button {
  min-height: 88px;
  border-radius: 14px;
}

.choice-row {
  margin-bottom: 14px;
}

.stat-grid {
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.stat-card {
  min-height: 86px;
  padding: 13px 10px;
  border-radius: 14px;
  text-align: center;
}

.stat-value {
  font-size: 1.7rem;
}

.stat-label {
  font-size: 0.86rem;
}

.week-bars {
  min-height: 130px;
}

.record-item,
.message-item,
.habit-button,
.setting-row {
  border-radius: 14px;
}

.setting-row {
  padding: 14px 0;
}

.segmented button,
.toggle-button {
  border-radius: 10px;
}

.dashboard-head {
  margin: 0;
  padding: 18px;
  min-height: 128px;
  align-items: center;
  background: linear-gradient(135deg, #1e3a8a, #2563eb);
  color: #fff;
}

.dashboard-head .eyebrow,
.dashboard-head h2,
.dashboard-head span {
  color: #fff;
}

/* Senior-first game cards: image-led, high target clarity */
.target-hint {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 14px;
  align-items: center;
  min-height: 92px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(10, 132, 255, 0.22);
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.88), rgba(232, 244, 255, 0.58)),
    rgba(10, 132, 255, 0.08);
  box-shadow: 0 10px 22px rgba(31, 41, 55, 0.09), var(--inner-glow);
}

.target-hint strong {
  color: var(--heading);
  font-size: 1.18rem;
  line-height: 1.25;
}

.space-problem-panel {
  padding: 14px;
  border: 2px solid rgba(10, 132, 255, 0.44);
  border-radius: 24px;
  background:
    linear-gradient(145deg, rgba(232, 244, 255, 0.94), rgba(255, 255, 255, 0.72)),
    rgba(10, 132, 255, 0.1);
  box-shadow: 0 14px 30px rgba(10, 132, 255, 0.13), var(--inner-glow);
}

.space-panel-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.space-panel-label span,
.answer-guide {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 13px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 1000;
  letter-spacing: 0;
}

.space-panel-label span {
  background: rgba(10, 132, 255, 0.16);
  color: var(--ios-blue);
}

.space-panel-label strong {
  color: var(--heading);
  font-size: 1.02rem;
  line-height: 1.25;
  text-align: right;
}

.picture-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.target-picture {
  width: 68px;
  height: 68px;
}

.memory-picture,
.find-picture,
.pattern-picture,
.choice-picture {
  width: min(78%, 92px);
  height: min(78%, 92px);
  margin: auto;
}

.memory-card,
.find-cell,
.pattern-tile,
.choice-button {
  display: grid;
  place-items: center;
  touch-action: manipulation;
}

.memory-card {
  min-height: 120px;
}

.memory-card:not(.flipped):not(.matched) {
  border-color: rgba(10, 132, 255, 0.52);
}

.card-back {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.2);
  color: currentColor;
  font-size: 2.45rem;
  font-weight: 1000;
  line-height: 1;
}

.find-cell,
.pattern-tile,
.choice-button {
  min-height: 104px;
  padding: 8px;
}

.space-problem-panel .pattern-row {
  grid-template-columns: repeat(4, minmax(62px, 1fr));
  gap: 10px;
}

.space-problem-panel .pattern-tile {
  min-height: 116px;
  border: 2px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 20px rgba(31, 41, 55, 0.08);
}

.space-problem-panel .pattern-missing {
  border: 3px dashed rgba(10, 132, 255, 0.72);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(232, 244, 255, 0.78)),
    rgba(10, 132, 255, 0.12);
}

.space-problem-panel .pattern-missing .card-back {
  width: 66px;
  height: 66px;
  background: rgba(10, 132, 255, 0.13);
  color: var(--ios-blue);
  font-size: 3rem;
}

.answer-guide {
  display: none;
  width: fit-content;
  margin: 18px auto 10px;
  background: rgba(15, 23, 42, 0.9);
  color: #fff;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.18);
}

.answer-guide.show {
  display: flex;
}

.answer-guide::after {
  content: "↓";
  margin-left: 8px;
  font-size: 1.1rem;
  line-height: 1;
}

.answer-choice-row {
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  padding: 12px;
  border: 2px solid rgba(15, 23, 42, 0.12);
  border-radius: 24px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.78), rgba(248, 250, 252, 0.54)),
    rgba(255, 255, 255, 0.5);
}

.answer-choice-row .choice-button {
  min-height: 96px;
  border: 2px solid rgba(10, 132, 255, 0.28);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(232, 244, 255, 0.58)),
    rgba(10, 132, 255, 0.08);
}

.answer-choice-row .choice-button:active {
  transform: scale(0.98);
}

.choice-button:focus-visible,
.find-cell:focus-visible,
.memory-card:focus-visible {
  outline: 4px solid rgba(10, 132, 255, 0.36);
  outline-offset: 3px;
}

.choice-button.correct .choice-picture,
.find-cell.found .find-picture,
.memory-card.matched .memory-picture {
  filter: saturate(1.08) drop-shadow(0 8px 10px rgba(34, 197, 94, 0.18));
}

.mission-list {
  margin-top: 12px;
}

#startNext {
  margin-top: 14px;
  margin-bottom: 4px;
}

@media (max-width: 430px) {
  .memory-grid,
  .find-grid,
  .pattern-row,
  .choice-row {
    gap: 10px;
  }

  .memory-card,
  .find-cell,
  .pattern-tile,
  .choice-button {
    min-height: 92px;
  }

  .space-problem-panel {
    padding: 12px;
  }

  .space-problem-panel .pattern-row {
    gap: 8px;
  }

  .space-problem-panel .pattern-tile {
    min-height: 94px;
  }

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

  .target-hint {
    grid-template-columns: 62px 1fr;
    min-height: 82px;
  }

  .target-picture {
    width: 58px;
    height: 58px;
  }
}

.dashboard-head h2 {
  font-size: 1.38rem;
}

.dashboard-panel > .stat-grid,
.dashboard-panel > .record-section,
.dashboard-panel > .action-stack {
  margin: 14px 18px 16px;
}

.dashboard-panel .record-section {
  padding: 16px;
}

.difficulty-panel .section-copy {
  margin-bottom: 12px;
  font-size: 0.94rem;
}

.difficulty-options {
  display: grid;
  gap: 10px;
}

.difficulty-button {
  width: 100%;
  min-height: 64px;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
}

.difficulty-button strong {
  color: var(--heading);
  font-size: 1.08rem;
}

.difficulty-button span {
  color: var(--muted);
  font-weight: 800;
}

.difficulty-button.active {
  border-color: #cdddff;
  background: var(--primary-soft);
}

.difficulty-button.active strong {
  color: var(--primary);
}

.daily-habit-card,
.lifestyle-summary,
.onboarding-card,
.game-progress {
  border: 1px solid var(--glass-line);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.84), rgba(255, 255, 255, 0.46)),
    var(--glass);
  box-shadow: var(--glass-shadow), var(--inner-glow);
  backdrop-filter: blur(22px) saturate(165%);
  -webkit-backdrop-filter: blur(22px) saturate(165%);
}

.daily-habit-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 16px;
  margin: 12px 0 16px;
}

.onboarding-card {
  padding: 22px 18px;
  text-align: center;
}

.onboarding-mark {
  margin: 4px auto 8px;
  font-size: 3.5rem;
}

.onboarding-card h2 {
  margin-bottom: 4px;
  font-size: 1.85rem;
}

.onboarding-card > p {
  margin-bottom: 18px;
  color: var(--muted);
  font-weight: 900;
}

.form-field,
.consent-row,
.editable-setting {
  text-align: left;
}

.form-field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.form-field span,
.editable-setting span {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 900;
}

.form-field input,
.editable-setting input {
  width: 100%;
  min-height: 52px;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--heading);
  padding: 0 14px;
  font-size: 1rem;
  font-weight: 900;
  box-shadow: var(--inner-glow);
}

.consent-row {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: start;
  margin: 12px 0;
  color: var(--text);
  font-weight: 800;
}

.consent-row input {
  width: 24px;
  height: 24px;
  margin-top: 2px;
}

.game-progress {
  margin-bottom: 14px;
  padding: 12px 14px;
  color: var(--primary);
  font-weight: 900;
}

.record-meta {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.9rem;
}

.toggle-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.daily-habit-label {
  display: block;
  margin-bottom: 5px;
  color: var(--ios-blue);
  font-size: 0.86rem;
  font-weight: 900;
}

.daily-habit-copy strong {
  display: block;
  color: var(--heading);
  font-size: 1.14rem;
}

.daily-habit-copy p {
  margin: 4px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.habit-check-button {
  min-width: 72px;
  min-height: 54px;
  border: 1px solid rgba(10, 132, 255, 0.36);
  border-radius: 16px;
  background: rgba(10, 132, 255, 0.14);
  color: var(--ios-blue);
  box-shadow: var(--inner-glow);
  font-weight: 900;
  cursor: pointer;
}

.habit-check-button.done {
  border-color: rgba(48, 209, 88, 0.42);
  background: rgba(48, 209, 88, 0.18);
  color: #0f6b2e;
}

.lifestyle-summary {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
  align-items: center;
  padding: 14px;
}

.lifestyle-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: rgba(10, 132, 255, 0.14);
  font-size: 1.6rem;
}

.lifestyle-summary strong,
.lifestyle-summary span {
  display: block;
}

.lifestyle-summary strong {
  color: var(--heading);
  font-size: 1rem;
}

.lifestyle-summary span {
  color: var(--muted);
  font-weight: 800;
}

.lifestyle-summary.done .lifestyle-icon {
  background: rgba(48, 209, 88, 0.18);
}

.toast {
  border-radius: 14px;
}

@media (min-width: 901px) {
  .app-shell[data-role="mother"] .dashboard-panel {
    opacity: 0.58;
    transform: scale(0.96);
  }

  .app-shell[data-role="family"] .phone-panel {
    opacity: 0.58;
    transform: scale(0.96);
  }

  .phone-panel,
  .dashboard-panel {
    transition: opacity 160ms ease, transform 160ms ease;
  }
}

@media (max-width: 900px) {
  .main-layout {
    padding: 18px 10px 42px;
    justify-items: center;
  }

  .phone-panel,
  .dashboard-panel {
    width: min(390px, 100%);
    height: min(780px, calc(100vh - 126px));
    border-width: 10px;
    border-radius: 38px;
  }

  .stat-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 430px) {
  .topbar {
    padding: 12px;
  }

  .main-layout {
    padding: 12px 0 30px;
  }

  .phone-panel,
  .dashboard-panel {
    border-left-width: 0;
    border-right-width: 0;
    border-radius: 0;
    width: 100%;
    height: calc(100vh - 112px);
  }

  .device-notch {
    display: none;
  }

  .mission-card {
    grid-template-columns: 48px 1fr auto;
    gap: 12px;
    padding: 15px;
  }

  .mission-icon {
    width: 48px;
    height: 48px;
    font-size: 2rem;
  }

  .daily-habit-card {
    grid-template-columns: 1fr;
  }

  .habit-check-button {
    width: 100%;
  }
}

/* iOS 26-inspired Liquid Glass pass */
:root {
  --ios-bg: #f4f7fb;
  --glass: rgba(255, 255, 255, 0.62);
  --glass-strong: rgba(255, 255, 255, 0.78);
  --glass-soft: rgba(255, 255, 255, 0.42);
  --glass-line: rgba(255, 255, 255, 0.78);
  --glass-shadow: 0 18px 46px rgba(38, 51, 77, 0.18);
  --inner-glow: inset 0 1px 0 rgba(255, 255, 255, 0.92), inset 0 -1px 0 rgba(255, 255, 255, 0.34);
  --ios-blue: #0a84ff;
  --ios-green: #30d158;
  --ios-orange: #ff9f0a;
  --ios-red: #ff453a;
  --ios-text: #111827;
}

html {
  background:
    linear-gradient(135deg, #f9fbff 0%, #eef5f7 38%, #fff8ec 100%);
}

body {
  background:
    linear-gradient(160deg, rgba(10, 132, 255, 0.12), transparent 32%),
    linear-gradient(25deg, rgba(255, 159, 10, 0.14), transparent 40%),
    var(--ios-bg);
  color: var(--ios-text);
}

.topbar {
  margin: 12px auto 0;
  width: min(980px, calc(100% - 24px));
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.56);
  box-shadow: 0 12px 30px rgba(31, 41, 55, 0.12);
  color: var(--heading);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
}

.topbar .eyebrow,
.topbar h1 {
  color: var(--heading);
}

.topbar .eyebrow {
  color: rgba(31, 41, 55, 0.64);
}

.role-button {
  border: 1px solid rgba(255, 255, 255, 0.76);
  background: rgba(255, 255, 255, 0.5);
  color: var(--heading);
  box-shadow: var(--inner-glow);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
}

.role-button.active {
  background: rgba(10, 132, 255, 0.88);
  color: #fff;
  box-shadow: 0 10px 24px rgba(10, 132, 255, 0.28), var(--inner-glow);
}

.phone-panel,
.dashboard-panel {
  border-color: rgba(20, 24, 34, 0.88);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.24), transparent 36%),
    rgba(246, 249, 252, 0.84);
  box-shadow: 0 24px 70px rgba(20, 24, 34, 0.32);
}

.device-notch {
  background: rgba(20, 24, 34, 0.92);
}

.phone-head,
.dashboard-head {
  background: rgba(255, 255, 255, 0.34);
  border-bottom: 1px solid rgba(255, 255, 255, 0.54);
  backdrop-filter: blur(22px) saturate(170%);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
}

.phone-head strong,
.dashboard-head h2 {
  letter-spacing: 0;
}

.icon-button,
.primary-action,
.call-button,
.secondary-action,
.back-button,
.habit-button,
.segmented button,
.toggle-button,
.difficulty-button,
.nav-item {
  border-width: 1px;
  border-color: rgba(255, 255, 255, 0.76);
  box-shadow: var(--inner-glow);
}

.icon-button,
.secondary-action,
.back-button,
.habit-button,
.segmented button,
.toggle-button {
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
}

.primary-action {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent 42%),
    rgba(10, 132, 255, 0.92);
  box-shadow: 0 16px 34px rgba(10, 132, 255, 0.28), var(--inner-glow);
}

.call-button {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.26), transparent 42%),
    rgba(48, 209, 88, 0.9);
  color: #082915;
  box-shadow: 0 16px 34px rgba(48, 209, 88, 0.22), var(--inner-glow);
}

.progress-block,
.notice-box,
.record-section,
.habit-area,
.setting-list,
.message-list,
.mission-card,
.stat-card,
.record-item,
.message-item,
.difficulty-button {
  border: 1px solid var(--glass-line);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.84), rgba(255, 255, 255, 0.46)),
    var(--glass);
  box-shadow: var(--glass-shadow), var(--inner-glow);
  backdrop-filter: blur(22px) saturate(165%);
  -webkit-backdrop-filter: blur(22px) saturate(165%);
}

.progress-block {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.82), rgba(234, 240, 255, 0.56)),
    rgba(234, 240, 255, 0.7);
}

.progress-bar {
  background: rgba(255, 255, 255, 0.58);
  box-shadow: inset 0 1px 2px rgba(31, 41, 55, 0.16);
}

.progress-bar span {
  background:
    linear-gradient(90deg, var(--ios-orange), #ffd60a);
  box-shadow: 0 0 14px rgba(255, 159, 10, 0.44);
}

.mission-card {
  overflow: hidden;
}

.mission-card::before {
  content: "";
  position: absolute;
  inset: 1px 1px auto 1px;
  height: 38%;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.44), transparent);
  pointer-events: none;
}

.mission-card {
  position: relative;
}

.mission-card:hover {
  border-color: rgba(10, 132, 255, 0.46);
  box-shadow: 0 18px 44px rgba(10, 132, 255, 0.16), var(--inner-glow);
}

.mission-icon {
  filter: drop-shadow(0 8px 14px rgba(31, 41, 55, 0.16));
}

.mission-status {
  background: rgba(48, 209, 88, 0.16);
  color: #0f6b2e;
  border: 1px solid rgba(48, 209, 88, 0.28);
  box-shadow: var(--inner-glow);
}

.bottom-nav {
  left: 14px;
  right: 14px;
  bottom: 12px;
  height: 68px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.5);
  box-shadow: 0 16px 36px rgba(31, 41, 55, 0.16), var(--inner-glow);
  overflow: hidden;
  backdrop-filter: blur(26px) saturate(170%);
  -webkit-backdrop-filter: blur(26px) saturate(170%);
}

.nav-item {
  min-height: 66px;
  border-radius: 22px;
  color: rgba(31, 41, 55, 0.62);
}

.nav-item.active {
  background: rgba(10, 132, 255, 0.14);
  color: var(--ios-blue);
}

.memory-card,
.find-cell,
.pattern-tile,
.choice-button {
  border: 1px solid rgba(255, 255, 255, 0.78);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.42)),
    rgba(255, 255, 255, 0.58);
  color: var(--heading);
  box-shadow: 0 12px 26px rgba(31, 41, 55, 0.12), var(--inner-glow);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
}

.memory-card:not(.flipped):not(.matched) {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 45%),
    rgba(10, 132, 255, 0.82);
  color: #fff;
}

.memory-card.flipped,
.memory-card.matched,
.find-cell.found,
.choice-button.correct {
  border-color: rgba(48, 209, 88, 0.46);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.82), rgba(231, 248, 238, 0.62)),
    rgba(48, 209, 88, 0.18);
}

.choice-button.wrong {
  border-color: rgba(255, 69, 58, 0.52);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.82), rgba(255, 241, 242, 0.66)),
    rgba(255, 69, 58, 0.14);
}

.dashboard-head {
  background:
    linear-gradient(145deg, rgba(10, 132, 255, 0.74), rgba(255, 255, 255, 0.28)),
    rgba(10, 132, 255, 0.48);
  color: #fff;
  box-shadow: var(--inner-glow);
}

.dashboard-head .eyebrow,
.dashboard-head h2,
.dashboard-head span {
  color: #fff;
  text-shadow: 0 1px 8px rgba(15, 23, 42, 0.18);
}

.difficulty-button.active,
.segmented button.active,
.toggle-button[aria-pressed="true"] {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.72), rgba(232, 242, 255, 0.48)),
    rgba(10, 132, 255, 0.18);
  border-color: rgba(10, 132, 255, 0.36);
  color: var(--ios-blue);
}

.toggle-button[aria-pressed="false"] {
  background: rgba(255, 69, 58, 0.12);
  border-color: rgba(255, 69, 58, 0.34);
  color: #9f1d17;
}

.day-bar span:first-child {
  background: linear-gradient(180deg, var(--ios-blue), #64d2ff);
  box-shadow: 0 8px 16px rgba(10, 132, 255, 0.18);
}

.toast {
  background: rgba(17, 24, 39, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: 0 20px 44px rgba(17, 24, 39, 0.26);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
}

@media (max-width: 430px) {
  .bottom-nav {
    left: 12px;
    right: 12px;
  }
}

/* Fit-to-screen game pass */
.app-shell[data-screen="game"] .phone-panel {
  padding-bottom: 0;
}

.app-shell[data-screen="game"] .status-space,
.app-shell[data-screen="game"] .phone-head,
.app-shell[data-screen="game"] .bottom-nav {
  display: none;
}

.app-shell[data-screen="game"] .view-stack {
  height: 100%;
  padding-top: 18px;
}

.screen[data-view="game"].active {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  padding: 10px 14px 12px;
}

.screen[data-view="game"] .back-button {
  display: inline-flex;
  width: auto;
  min-height: 34px;
  margin: 0;
  padding: 0 12px;
  align-self: flex-start;
  border-radius: 999px;
  font-size: 0.86rem;
}

.screen[data-view="game"] .game-head {
  margin-bottom: 0;
}

.screen[data-view="game"] .game-head h2 {
  display: none;
}

.screen[data-view="game"] .game-head p {
  font-size: 1.02rem;
  line-height: 1.25;
}

.screen[data-view="game"] .game-progress {
  margin-bottom: 2px;
  padding: 8px 12px;
  border-radius: 18px;
  font-size: 0.98rem;
  line-height: 1.25;
}

.screen[data-view="game"] #restartGame {
  display: none;
}

.game-board-memory,
.game-board-focus,
.game-board-space {
  flex: 0 0 auto;
}

.game-board-memory .memory-grid,
.game-board-focus .find-grid {
  gap: 8px;
}

.game-board-memory .memory-card,
.game-board-focus .find-cell {
  aspect-ratio: 1;
  min-height: 0;
  border-radius: 16px;
}

.game-board-memory .memory-picture,
.game-board-focus .find-picture {
  width: min(72%, 68px);
  height: min(72%, 68px);
}

.game-board-memory .card-back {
  width: 50px;
  height: 50px;
  border-radius: 16px;
  font-size: 2.1rem;
}

.game-board-memory.difficulty-hard .memory-grid {
  gap: 7px;
}

.game-board-memory.difficulty-hard .memory-picture {
  width: min(68%, 54px);
  height: min(68%, 54px);
}

.game-board-memory.difficulty-hard .card-back {
  width: 44px;
  height: 44px;
  font-size: 1.9rem;
}

.game-board-focus .target-hint {
  grid-template-columns: 54px 1fr;
  min-height: 58px;
  margin-bottom: 6px;
  padding: 6px 9px;
  border-radius: 16px;
}

.game-board-focus .target-picture {
  width: 46px;
  height: 46px;
}

.game-board-focus .target-hint strong {
  font-size: 1rem;
}

.game-board-focus .find-cell {
  aspect-ratio: auto;
  min-height: 58px;
}

.game-board-focus.difficulty-hard .find-grid {
  gap: 6px;
}

.game-board-focus.difficulty-hard .find-cell {
  min-height: 50px;
}

.game-board-focus.difficulty-hard .find-picture {
  width: min(66%, 48px);
  height: min(66%, 48px);
}

.game-board-space .space-problem-panel {
  padding: 8px;
  border-radius: 18px;
}

.game-board-space .space-panel-label {
  margin-bottom: 6px;
}

.game-board-space .space-panel-label span,
.screen[data-view="game"] .answer-guide {
  min-height: 24px;
  padding: 0 9px;
  font-size: 0.78rem;
}

.game-board-space .space-panel-label strong {
  font-size: 0.92rem;
}

.game-board-space .pattern-row {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.game-board-space .pattern-tile {
  min-height: 62px;
  aspect-ratio: auto;
  border-radius: 16px;
}

.game-board-space .pattern-picture {
  width: min(70%, 48px);
  height: min(70%, 48px);
}

.game-board-space .pattern-missing .card-back {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  font-size: 2rem;
}

.screen[data-view="game"] .answer-guide {
  margin: 4px auto 3px;
}

.screen[data-view="game"] .answer-choice-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 0;
  padding: 6px;
  border-radius: 18px;
}

.screen[data-view="game"] .answer-choice-row .choice-button {
  min-height: 56px;
  aspect-ratio: auto;
  border-radius: 16px;
}

.screen[data-view="game"] .answer-choice-row .choice-picture {
  width: min(68%, 44px);
  height: min(68%, 44px);
}

@media (max-width: 430px) {
  .screen[data-view="game"].active {
    gap: 6px;
    padding-left: 14px;
    padding-right: 14px;
  }

  .game-board-memory .memory-grid,
  .game-board-focus .find-grid,
  .game-board-space .pattern-row {
    gap: 6px;
  }

  .screen[data-view="game"] .game-progress {
    padding: 7px 10px;
    font-size: 0.92rem;
  }

  .screen[data-view="game"] .game-head p {
    font-size: 0.9rem;
  }
}

/* Floating top chrome pass */
.status-space {
  height: 0;
}

.phone-head {
  position: absolute;
  top: 30px;
  left: 18px;
  right: 18px;
  z-index: 7;
  min-height: 64px;
  padding: 8px 12px 8px 18px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.54);
  box-shadow: 0 18px 38px rgba(31, 41, 55, 0.14), var(--inner-glow);
  backdrop-filter: blur(26px) saturate(170%);
  -webkit-backdrop-filter: blur(26px) saturate(170%);
}

.phone-head .icon-button {
  width: 50px;
  height: 50px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
}

.view-stack {
  height: 100%;
}

.screen {
  padding: 116px 18px 104px;
}

.app-shell[data-screen="game"] .view-stack {
  height: 100%;
  padding-top: 18px;
}

.app-shell[data-screen="game"] .screen[data-view="game"].active {
  padding: 10px 14px 12px;
}

@media (max-width: 430px) {
  .phone-head {
    top: 18px;
    left: 14px;
    right: 14px;
  }

  .screen {
    padding-top: 104px;
  }
}

/* Family dashboard aligned with the floating iOS shell */
.dashboard-panel {
  padding: 0;
  overflow: hidden;
}

.dashboard-panel .status-space {
  height: 0;
}

.dashboard-head {
  position: absolute;
  top: 30px;
  left: 18px;
  right: 18px;
  z-index: 7;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  min-height: 74px;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.54);
  color: var(--heading);
  box-shadow: 0 18px 38px rgba(31, 41, 55, 0.14), var(--inner-glow);
  backdrop-filter: blur(26px) saturate(170%);
  -webkit-backdrop-filter: blur(26px) saturate(170%);
}

.dashboard-head .eyebrow {
  color: var(--ios-blue);
  font-size: 0.78rem;
}

.dashboard-head h2,
.dashboard-head span {
  color: var(--heading);
  text-shadow: none;
}

.dashboard-head h2 {
  font-size: 1.22rem;
  line-height: 1.15;
}

.dashboard-head span {
  max-width: 108px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.25;
  text-align: right;
}

.dashboard-scroll {
  height: 100%;
  overflow-y: auto;
  padding: 122px 18px 150px;
  scrollbar-width: none;
}

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

.dashboard-scroll > .stat-grid,
.dashboard-scroll > .record-section {
  margin: 0 0 14px;
}

.dashboard-scroll > .stat-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-scroll .stat-card {
  min-height: 86px;
  border-radius: 22px;
  padding: 14px 12px;
}

.dashboard-scroll .stat-value {
  font-size: 1.46rem;
}

.dashboard-scroll .record-section {
  padding: 16px;
  border-radius: 24px;
}

.dashboard-scroll .week-bars {
  min-height: 110px;
}

.dashboard-action-dock {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 14px;
  z-index: 8;
  gap: 8px;
  margin: 0;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.54);
  box-shadow: 0 16px 36px rgba(31, 41, 55, 0.16), var(--inner-glow);
  backdrop-filter: blur(26px) saturate(170%);
  -webkit-backdrop-filter: blur(26px) saturate(170%);
}

.dashboard-action-dock .call-button,
.dashboard-action-dock .secondary-action {
  min-height: 50px;
  margin: 0;
  border-radius: 18px;
  font-size: 1rem;
}

@media (max-width: 430px) {
  .dashboard-head {
    top: 18px;
    left: 14px;
    right: 14px;
  }

  .dashboard-scroll {
    padding: 110px 14px 148px;
  }

  .dashboard-action-dock {
    left: 14px;
    right: 14px;
    bottom: 12px;
  }
}

/* Records tab cleanup */
.screen[data-view="records"] {
  display: none;
}

.screen[data-view="records"].active {
  display: block;
}

.records-hero {
  margin-bottom: 14px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 28px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.86), rgba(232, 244, 255, 0.54)),
    rgba(255, 255, 255, 0.58);
  box-shadow: 0 16px 36px rgba(31, 41, 55, 0.12), var(--inner-glow);
  backdrop-filter: blur(22px) saturate(165%);
  -webkit-backdrop-filter: blur(22px) saturate(165%);
}

.records-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin-bottom: 8px;
  padding: 0 11px;
  border-radius: 999px;
  background: rgba(10, 132, 255, 0.14);
  color: var(--ios-blue);
  font-size: 0.82rem;
  font-weight: 1000;
}

.records-hero h2 {
  margin-bottom: 4px;
  font-size: 1.46rem;
  line-height: 1.18;
}

.records-hero p {
  margin: 0;
  color: var(--muted);
  font-weight: 850;
  line-height: 1.35;
}

.screen[data-view="records"] .stat-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.screen[data-view="records"] .stat-card {
  min-height: 82px;
  border-radius: 22px;
  padding: 14px 12px;
  text-align: left;
}

.screen[data-view="records"] .stat-card:first-child {
  grid-column: 1 / -1;
  min-height: 104px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  background:
    linear-gradient(145deg, rgba(10, 132, 255, 0.88), rgba(100, 210, 255, 0.58)),
    rgba(10, 132, 255, 0.76);
  color: #fff;
}

.screen[data-view="records"] .stat-card:first-child .stat-value,
.screen[data-view="records"] .stat-card:first-child .stat-label {
  color: #fff;
}

.screen[data-view="records"] .stat-card:first-child .stat-value {
  font-size: 2.35rem;
}

.screen[data-view="records"] .stat-value {
  font-size: 1.5rem;
  line-height: 1.05;
}

.screen[data-view="records"] .stat-label {
  display: block;
  margin-top: 6px;
  font-size: 0.88rem;
  line-height: 1.25;
}

.screen[data-view="records"] .record-section {
  margin-bottom: 14px;
  padding: 16px;
  border-radius: 26px;
}

.screen[data-view="records"] .record-section h3 {
  margin-bottom: 12px;
  font-size: 1.08rem;
}

.screen[data-view="records"] .week-bars {
  min-height: 120px;
  padding: 4px 2px 0;
}

.screen[data-view="records"] .day-bar {
  gap: 7px;
}

.screen[data-view="records"] .day-bar span:first-child {
  border-radius: 999px 999px 8px 8px;
  background: linear-gradient(180deg, var(--ios-blue), #64d2ff);
}

.screen[data-view="records"] .day-bar span:last-child {
  font-size: 0.78rem;
}

.screen[data-view="records"] .record-list {
  gap: 8px;
}

.screen[data-view="records"] .record-item {
  border-radius: 18px;
  padding: 13px 14px;
}

.record-entry strong,
.record-time,
.record-meta {
  display: block;
}

.record-entry strong {
  color: var(--heading);
  font-size: 1.02rem;
}

.record-time {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 850;
}

.empty-record {
  color: var(--heading);
}

@media (max-width: 430px) {
  .records-hero {
    padding: 16px;
  }

  .screen[data-view="records"] .stat-grid {
    gap: 8px;
  }
}
