:root {
  --bg-outer: #090f1d;
  --bg-app: #10192e;
  --bg-card: #18243f;
  --bg-card-soft: #1e2c4b;
  --border: #2c3d63;
  --text-main: #ffffff;
  --text-sub: #cbd5e1;
  --text-muted: #94a3b8;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  --game-bg: rgba(245, 158, 11, 0.14);
  --game-border: #f59e0b;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg-outer);
  color: var(--text-main);
  font-family: "Malgun Gothic", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  overflow-x: hidden;
}

.phone-shell {
  width: 100%;
  max-width: 390px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg-app);
  display: flex;
  flex-direction: column;
  border-left: 1px solid #1b2847;
  border-right: 1px solid #1b2847;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(16, 25, 46, 0.96);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.brand-badge {
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #93c5fd;
  font-size: 15px;
  white-space: nowrap;
}

.child-pill {
  font-weight: 700;
  font-size: 16px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-chip {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  background: rgba(34, 197, 94, 0.18);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.45);
}

.status-chip.is-locked {
  background: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.45);
}

.status-chip.is-academy {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.5);
}

.app-main {
  flex: 1;
  padding: 16px 14px 88px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
}

.card-title {
  margin: 0 0 10px;
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
}

.muted {
  color: var(--text-muted);
  font-size: 15px;
}

.subtext {
  color: var(--text-sub);
  font-size: 15px;
}

.time-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  gap: 8px;
}

.time-big {
  font-size: 22px;
  font-weight: 700;
}

.progress-track {
  width: 100%;
  height: 12px;
  background: #0f172a;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 12px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
  border-radius: 999px;
  transition: width 0.2s ease;
}

.btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-width: 0;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-danger {
  background: #dc2626;
  color: #ffffff;
}

.btn-secondary {
  background: var(--bg-card-soft);
  color: var(--text-main);
  border-color: var(--border);
}

.btn-small {
  flex: 0 0 auto;
  padding: 8px 12px;
}

.timeline-list,
.stack-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.timeline-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg-card-soft);
  border-left: 4px solid #475569;
}

.timeline-item.is-game {
  background: var(--game-bg);
  border-left-color: var(--game-border);
}

.timeline-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.timeline-time {
  color: #93c5fd;
  font-size: 15px;
  white-space: nowrap;
}

.timeline-title {
  color: var(--text-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tag-game {
  color: #fcd34d;
  font-size: 15px;
  font-weight: 700;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.field label {
  font-weight: 600;
  color: var(--text-sub);
  font-size: 15px;
}

.input,
.select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0f172a;
  color: var(--text-main);
  font-family: inherit;
  font-size: 15px;
}

.day-toggles {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.day-btn {
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0f172a;
  color: var(--text-sub);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.day-btn.is-on {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.time-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.list-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg-card-soft);
  border: 1px solid var(--border);
}

.row-main {
  min-width: 0;
  flex: 1;
}

.row-title {
  font-weight: 700;
  color: var(--text-main);
}

.row-sub {
  color: var(--text-muted);
  font-size: 15px;
}

.toast-banner {
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.5);
  color: #dbeafe;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 15px;
}

.tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 390px;
  background: #0b1222;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 6px 4px;
  gap: 2px;
  z-index: 20;
}

.tab-btn {
  min-height: 48px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px 2px;
}

.tab-btn.is-active {
  background: var(--bg-card);
  color: #ffffff;
}

.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
}

.tab-badge.is-hidden {
  display: none;
}

/* 일정 켜짐/꺼짐: 켜지면 초록 채움, 꺼지면 회색 테두리 + 줄 흐리게 */
.toggle-btn {
  min-width: 72px;
  min-height: 44px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  border: 2px solid #334155;
  background: transparent;
  color: #94a3b8;
}
.toggle-btn.is-on {
  background: #22c55e;
  border-color: #22c55e;
  color: #052e16;
}
.list-row.is-off .row-title,
.list-row.is-off .row-sub {
  opacity: 0.5;
}

/* 요일별 시간 */
.slot-list { display: flex; flex-direction: column; gap: 8px; }
.slot-row { display: grid; grid-template-columns: 24px minmax(0, 1fr) 10px minmax(0, 1fr); align-items: center; gap: 6px; }
.slot-row .input { min-width: 0; width: 100%; box-sizing: border-box; padding-left: 8px; padding-right: 4px; }
.slot-day { font-weight: 700; text-align: center; }
.slot-sep { text-align: center; color: #94a3b8; }

/* 맨 위 아이 PC 바꾸기 */
#header-child-name { cursor: pointer; }
.device-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid #334155;
  background: transparent;
  color: inherit;
  font-size: 16px;
  cursor: pointer;
}
.device-option.is-current { border-color: #3b82f6; background: rgba(59, 130, 246, 0.15); font-weight: 700; }

/* "요일마다 시간이 달라요" 같은 글자 버튼 */
.link-btn {
  background: none;
  border: none;
  color: #60a5fa;
  font-size: 15px;
  padding: 10px 0;
  min-height: 44px;
  cursor: pointer;
  text-decoration: underline;
}

/* 처음 시작 화면 (온보딩) */
.phone-shell.is-onboarding .app-header,
.phone-shell.is-onboarding .tab-bar {
  display: none;
}

.phone-shell.is-onboarding .app-main {
  padding: 20px 16px 24px;
  min-height: 100vh;
  justify-content: space-between;
}

.onboarding-wrap {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1;
  gap: 20px;
}

.onboarding-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.onboarding-step {
  font-size: 15px;
  font-weight: 700;
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.16);
  border: 1px solid rgba(59, 130, 246, 0.4);
  padding: 4px 12px;
  border-radius: 999px;
}

.skip-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 15px;
  min-height: 44px;
  padding: 6px 4px;
  cursor: pointer;
  text-decoration: underline;
}

.onboarding-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.onboarding-title {
  margin: 0;
  font-size: 23px;
  font-weight: 700;
  line-height: 1.35;
}

.onboarding-desc {
  margin: 0;
  color: var(--text-sub);
  font-size: 16px;
}

.qr-box {
  height: 196px;
  border-radius: 16px;
  border: 2px dashed #475569;
  background: #0b1222;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  text-align: center;
}

.qr-frame {
  width: 78px;
  height: 78px;
  border: 3px solid #60a5fa;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #93c5fd;
  font-weight: 700;
  font-size: 16px;
}

.age-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.age-btn {
  min-height: 52px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card-soft);
  color: var(--text-main);
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.age-btn.is-selected {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.22);
}

.preset-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
}

.preset-row {
  display: flex;
  justify-content: space-between;
  font-size: 16px;
}

.onboarding-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-lg {
  min-height: 50px;
  font-size: 16px;
  width: 100%;
}

/* Q-033 서버 연결 스타일 */
.status-chip.is-online {
  background: rgba(34, 197, 94, 0.18);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.45);
}

.status-chip.is-offline {
  background: rgba(148, 163, 184, 0.14);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.badge-pending {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #fde047;
  background: rgba(234, 179, 8, 0.15);
  border: 1px solid rgba(234, 179, 8, 0.3);
  margin-bottom: 8px;
}

.btn-group-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  width: 100%;
}

.btn-group-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}

.auth-tabs {
  display: flex;
  background: var(--bg-card-soft);
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 16px;
  gap: 4px;
}

.auth-tab {
  flex: 1;
  padding: 8px;
  border-radius: 8px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

.auth-tab.is-active {
  background: var(--primary);
  color: #ffffff;
}

.auth-info {
  margin-top: 10px;
  font-size: 14px;
  color: var(--text-sub);
  line-height: 1.4;
}

.empty-guide {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-sub);
}

.empty-guide-icon {
  font-size: 36px;
  margin-bottom: 12px;
}

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-box {
  width: 100%;
  max-width: 360px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.loading-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  gap: 14px;
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spinner-spin 0.8s linear infinite;
}

@keyframes spinner-spin {
  to {
    transform: rotate(360deg);
  }
}

.child-summary-banner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 14px;
  color: var(--text-sub);
  line-height: 1.4;
}

.child-summary-title {
  color: var(--text-main);
  font-weight: 700;
  font-size: 15px;
}

.child-summary-breakdown {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-muted);
}

.device-group {
  margin-bottom: 12px;
}

.device-group-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  margin: 6px 4px 6px;
}


