:root {
  --sky: #0b3d66;
  --sky-dark: #082a48;
  --yellow: #f5b700;
  --green: #1f8a4c;
  --green-bg: #e6f6ec;
  --ink: #12181f;
  --muted: #55606b;
  --border: #d7dde3;
  --bg: #f6f8fa;
  --card: #ffffff;
  --danger: #b3261e;
  --radius: 14px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}

button, input, select {
  font: inherit;
}

.screen {
  min-height: 100vh;
  width: 100%;
}

/* ---------- Login ---------- */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(180deg, var(--sky) 0%, var(--sky-dark) 100%);
}

.login-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 32px 24px;
  width: 100%;
  max-width: 420px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}

.login-card h1 {
  font-size: 1.8rem;
  line-height: 1.25;
  margin: 0 0 8px;
  color: var(--sky-dark);
}

.login-sub {
  color: var(--muted);
  margin: 0 0 24px;
  font-size: 1.05rem;
}

.field-label {
  display: block;
  text-align: left;
  font-weight: 600;
  margin: 16px 0 6px;
  font-size: 1rem;
}

#username, #password {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 2px solid var(--border);
  font-size: 1.15rem;
  background: #fff;
  color: var(--ink);
}

#username:focus, #password:focus {
  outline: 3px solid var(--yellow);
  border-color: var(--sky);
}

.login-error {
  color: var(--danger);
  font-weight: 600;
  margin-top: 14px;
}

/* ---------- Buttons ---------- */
.btn {
  min-height: 48px;
  min-width: 44px;
  padding: 12px 18px;
  border-radius: 10px;
  border: 2px solid transparent;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.btn-primary {
  width: 100%;
  margin-top: 24px;
  background: var(--yellow);
  color: #3a2600;
}
.btn-primary:active { transform: scale(0.98); }

.btn-ghost {
  background: transparent;
  color: #fff;
  border-color: rgba(255,255,255,0.5);
}

.btn-secondary {
  background: var(--sky);
  color: #fff;
  width: 100%;
  margin-bottom: 12px;
}

.btn-outline {
  background: #fff;
  color: var(--danger);
  border-color: var(--danger);
  width: 100%;
}

/* ---------- App header ---------- */
.app-header {
  background: linear-gradient(180deg, var(--sky) 0%, var(--sky-dark) 100%);
  color: #fff;
  padding: 16px 16px 20px;
  position: sticky;
  top: 0;
  z-index: 5;
}

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

.header-top h1 {
  font-size: 1.35rem;
  margin: 0;
}

.progress-wrap {
  margin-top: 14px;
}

.progress-bar-track {
  background: rgba(255,255,255,0.25);
  border-radius: 999px;
  height: 18px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--yellow);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.progress-count {
  margin: 8px 0 0;
  font-weight: 700;
  font-size: 1.05rem;
  text-align: center;
}

/* ---------- Instructions ---------- */
.instructions {
  max-width: 640px;
  margin: 14px auto 4px;
  padding: 12px 18px;
  background: #fff8e0;
  border: 2px dashed var(--yellow);
  border-radius: 14px;
  color: var(--sky-dark);
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
}

/* ---------- Celebration ---------- */
.celebration {
  background: var(--green);
  color: #fff;
  text-align: center;
  font-size: 1.15rem;
  font-weight: 700;
  padding: 14px 16px;
}

/* ---------- Checklist ---------- */
.checklist {
  padding: 12px 12px 24px;
  max-width: 640px;
  margin: 0 auto;
}

.category {
  margin-bottom: 22px;
}

.category-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--sky-dark);
  margin: 18px 4px 10px;
  padding-bottom: 6px;
  border-bottom: 3px solid var(--yellow);
}

.item-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.item-number {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 999px;
  background: var(--sky-dark);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.item-line.checked .item-number {
  background: var(--green);
}

.item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  min-height: 44px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  flex: 1;
  min-width: 0;
}

.item-row:active {
  transform: scale(0.99);
}

.item-line.checked .item-row {
  background: var(--green-bg);
  border-color: var(--green);
}

.item-checkbox {
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-radius: 8px;
  border: 2.5px solid var(--sky);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  flex-shrink: 0;
}

.item-line.checked .item-checkbox {
  background: var(--green);
  border-color: var(--green);
}

.item-checkbox svg {
  width: 20px;
  height: 20px;
  opacity: 0;
  stroke: #fff;
  stroke-width: 3.5;
  fill: none;
}

.item-line.checked .item-checkbox svg {
  opacity: 1;
}

.item-row input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.item-icon {
  width: 56px;
  height: 56px;
  min-width: 56px;
  flex-shrink: 0;
}

img.item-icon {
  object-fit: contain;
}

.item-text {
  font-size: 1.02rem;
  line-height: 1.35;
  color: var(--ink);
}

/* ---------- Footer ---------- */
.app-footer {
  max-width: 640px;
  margin: 0 auto;
  padding: 8px 16px 32px;
}

/* ---------- Family view ---------- */
.family-content {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
}

.family-user-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.family-user-card h2 {
  margin: 0 0 8px;
  font-size: 1.1rem;
  color: var(--sky-dark);
}

.family-user-card .progress-bar-track {
  background: var(--border);
}

.family-count {
  font-weight: 700;
  color: var(--muted);
  margin: 8px 0 10px;
}

.family-dots {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.family-dot {
  aspect-ratio: 1;
  border-radius: 6px;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
}

.family-dot.done {
  background: var(--green);
  color: #fff;
}

/* ---------- Offline banner ---------- */
.offline-banner {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  background: var(--ink);
  color: #fff;
  padding: 12px 16px;
  border-radius: 10px;
  text-align: center;
  font-weight: 600;
  z-index: 20;
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

@media (min-width: 480px) {
  .item-text { font-size: 1.08rem; }
}
