  :root {
    --bg: #efe8da;
    --panel: #fdf9ee;
    --ink: #1a1a1a;
    --accent: #7a2e2e;
    --line: #d8cfb8;
  }
  * { box-sizing: border-box; }
  html, body {
    margin: 0;
    height: 100%;
    background: var(--bg);
    font-family: 'Courier New', monospace;
    color: var(--ink);
    -webkit-tap-highlight-color: transparent;
  }
  body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    padding: env(safe-area-inset-top, 10px) 12px calc(env(safe-area-inset-bottom, 10px) + 10px);
    gap: 8px;
  }
  .app {
    width: 100%;
    max-width: 380px;
    max-height: calc(100dvh - 20px);
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  header {
    text-align: center;
    padding-top: 0;
  }
  header .app-logo {
    width: 32px;
    height: 32px;
  }
  header h1 {
    font-size: 0.95rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin: 0;
  }
  header p {
    font-size: 0.62rem;
    opacity: 0.55;
    margin: 2px 0 0;
    letter-spacing: 1px;
  }

  .stage {
    position: relative;
    width: min(100%, 50dvh);
    aspect-ratio: 3 / 4;
    background: var(--panel);
    border: 3px solid var(--ink);
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    align-self: center;
  }
  .stage video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.35s ease;
  }
  .stage video.visible { opacity: 1; }

  .stage-caption {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(transparent, rgba(0,0,0,0.55) 55%);
    color: #fdf9ee;
    font-size: 0.85rem;
    font-weight: 700;
    text-align: center;
    min-height: 2.4em;
    display: flex;
    align-items: flex-end;
    justify-content: center;
  }

  .status-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
    opacity: 0.75;
    padding: 0 2px;
  }

  .meter {
    height: 6px;
    background: var(--line);
    border-radius: 3px;
    overflow: hidden;
    flex: 1;
    margin: 0 8px;
  }
  .meter-fill {
    height: 100%;
    background: var(--ink);
    transition: width 0.4s ease;
  }
  .meter-fill.vinculo { background: var(--accent); }

  .meters {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .meter-line {
    display: flex;
    align-items: center;
  }
  .meter-label {
    font-size: 0.65rem;
    letter-spacing: 0.5px;
    width: 90px;
    opacity: 0.7;
  }

  .tasks {
    background: var(--panel);
    border: 2px solid var(--ink);
    border-radius: 6px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 0 1 auto;
  }
  .tasks h2 {
    font-size: 0.75rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin: 0 0 2px;
    opacity: 0.8;
  }
  .task-input-row {
    display: flex;
    gap: 6px;
  }
  .task-input-row input {
    flex: 1;
    font-family: inherit;
    font-size: 0.85rem;
    padding: 8px 10px;
    border: 2px solid var(--ink);
    border-radius: 4px;
    background: #fff;
    color: var(--ink);
  }
  .task-input-row button {
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    background: var(--ink);
    color: var(--panel);
    border: none;
    border-radius: 4px;
    padding: 0 14px;
    cursor: pointer;
  }
  .task-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 110px;
    overflow-y: auto;
  }
  .task-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 4px;
    border-bottom: 1px dashed var(--line);
    font-size: 0.82rem;
  }
  .task-item.done .task-text {
    text-decoration: line-through;
    opacity: 0.45;
  }
  .task-check {
    width: 20px;
    height: 20px;
    border: 2px solid var(--ink);
    border-radius: 3px;
    flex-shrink: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    font-size: 0.75rem;
    line-height: 1;
  }
  .task-item.done .task-check {
    background: var(--ink);
    color: var(--panel);
  }
  .task-text {
    flex: 1;
  }
  .task-del {
    border: none;
    background: none;
    color: var(--accent);
    font-size: 0.9rem;
    cursor: pointer;
    opacity: 0.6;
    padding: 2px 4px;
  }
  .empty-hint {
    font-size: 0.72rem;
    opacity: 0.45;
    text-align: center;
    padding: 4px 0;
  }

  .advance-btn {
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    background: var(--accent);
    color: var(--panel);
    border: none;
    border-radius: 6px;
    padding: 9px;
    cursor: pointer;
    flex-shrink: 0;
  }
  .advance-btn:disabled { opacity: 0.4; }

  .stats-toggle-btn { flex-shrink: 0; padding: 7px; }

  .footnote {
    display: none;
    font-size: 0.62rem;
    opacity: 0.4;
    text-align: center;
    line-height: 1.5;
    padding: 4px 8px 0;
  }

  .onboarding-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: env(safe-area-inset-top, 24px) 24px calc(env(safe-area-inset-bottom, 24px) + 24px);
  }
  .onboarding-card {
    width: 100%;
    max-width: 340px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 18px;
  }
  .onboarding-card h2 {
    font-size: 1.15rem;
    line-height: 1.4;
    margin: 0;
    letter-spacing: 0.5px;
  }
  .onboarding-card p {
    font-size: 0.9rem;
    line-height: 1.6;
    opacity: 0.75;
    margin: 0;
  }
  .onboarding-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 4px;
  }
  .onboarding-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--line);
  }
  .onboarding-dots span.active {
    background: var(--ink);
  }
  .onboarding-next {
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    background: var(--ink);
    color: var(--panel);
    border: none;
    border-radius: 6px;
    padding: 13px;
    cursor: pointer;
    margin-top: 8px;
  }
  .app.hidden { display: none; }

  .stats-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 90;
    display: none;
    flex-direction: column;
    padding: env(safe-area-inset-top, 20px) 18px calc(env(safe-area-inset-bottom, 20px) + 18px);
    overflow-y: auto;
  }
  .stats-overlay.visible { display: flex; }
  .stats-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
  }
  .stats-header h2 {
    font-size: 0.95rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin: 0;
  }
  .stats-back {
    font-family: inherit;
    font-size: 0.75rem;
    background: none;
    border: 2px solid var(--ink);
    border-radius: 4px;
    padding: 6px 10px;
    cursor: pointer;
    color: var(--ink);
  }
  .stats-summary {
    background: var(--panel);
    border: 2px solid var(--ink);
    border-radius: 6px;
    padding: 14px;
    margin-bottom: 14px;
    text-align: center;
  }
  .stats-summary .big {
    font-size: 1.6rem;
    font-weight: 700;
  }
  .stats-summary .small {
    font-size: 0.72rem;
    opacity: 0.6;
    margin-top: 2px;
  }
  .stats-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .stats-entry {
    background: var(--panel);
    border: 1px solid var(--line);
    border-left: 4px solid var(--ink);
    border-radius: 4px;
    padding: 10px 12px;
  }
  .stats-entry.good { border-left-color: var(--accent); }
  .stats-entry .entry-title {
    font-size: 0.82rem;
    font-weight: 700;
    margin-bottom: 2px;
  }
  .stats-entry .entry-sub {
    font-size: 0.72rem;
    opacity: 0.6;
  }
  .stats-empty {
    text-align: center;
    font-size: 0.8rem;
    opacity: 0.5;
    padding: 30px 10px;
  }
  .stats-toggle-btn {
    font-family: inherit;
    font-size: 0.78rem;
    background: none;
    border: 2px solid var(--ink);
    color: var(--ink);
    border-radius: 6px;
    padding: 10px;
    cursor: pointer;
    letter-spacing: 0.5px;
  }

  .share-overlay {
    position: absolute;
    inset: 0;
    background: rgba(26,26,26,0.72);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 20px;
    text-align: center;
    z-index: 20;
  }
  .share-overlay.visible { display: flex; }
  .share-overlay p {
    color: #fdf9ee;
    font-size: 0.9rem;
    font-weight: 700;
    margin: 0;
    max-width: 240px;
  }
  .share-buttons {
    display: flex;
    gap: 8px;
  }
  .share-btn, .share-dismiss {
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    border-radius: 6px;
    padding: 10px 16px;
    cursor: pointer;
    border: none;
  }
  .share-btn {
    background: var(--accent);
    color: #fdf9ee;
  }
  .share-dismiss {
    background: transparent;
    color: #fdf9ee;
    border: 2px solid #fdf9ee;
  }
  .badge-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%) translateY(20px);
    background: var(--ink);
    color: var(--panel);
    font-size: 0.78rem;
    font-weight: 700;
    padding: 10px 18px;
    border-radius: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 200;
    white-space: nowrap;
  }
  .badge-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }

  .gm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20,16,10,0.88);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 20px;
    z-index: 300;
  }
  .gm-overlay.visible { display: flex; }
  .gm-card {
    width: 100%;
    max-width: 300px;
    aspect-ratio: 3 / 4;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0,0,0,0.5);
  }
  .gm-title {
    color: #fdf9ee;
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
    max-width: 260px;
    margin: 0;
  }
  .gm-sub {
    color: #fdf9ee;
    font-size: 0.75rem;
    opacity: 0.75;
    text-align: center;
    max-width: 260px;
    margin: 0;
  }
  .gm-buttons {
    display: flex;
    gap: 10px;
    margin-top: 4px;
  }

  .app-logo {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--ink);
    margin-bottom: 2px;
  }

  .main-nav {
    display: flex;
    justify-content: center;
    gap: 10px;
  }
  .main-nav .stats-toggle-btn {
    flex: 0 0 auto;
    padding: 10px 18px;
  }

.auth-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 150;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.auth-card h2 {
  text-align: center;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-size: 1rem;
  margin: 0 0 8px;
}
.auth-card input {
  font-family: inherit;
  font-size: 0.85rem;
  padding: 10px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
}
.auth-card button {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  background: var(--accent);
  color: var(--panel);
  border: none;
  border-radius: 6px;
  padding: 12px;
  cursor: pointer;
  margin-top: 4px;
}
.auth-switch {
  background: none !important;
  color: var(--ink) !important;
  font-weight: 400 !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  font-size: 0.75rem !important;
  opacity: 0.7;
}
.auth-error {
  color: var(--accent);
  font-size: 0.75rem;
  text-align: center;
  min-height: 1em;
}
.hidden { display: none !important; }
