/* Meme Pop — Pop Ink palette */

:root {
  /* App chrome (header + bottom) — darkest */
  --bg: #0f1115;
  /* Canvas workspace */
  --stage: #2e323a;
  --stage-deep: #252830;
  /* Control panel */
  --panel: #171a21;
  --elevated: #242833;
  --text: #f7f7f8;
  --muted: #9aa0ab;
  /* Accent: pop pink-red (CTA / selection) */
  --orange: #ff3d6e;
  --orange-dim: rgba(255, 61, 110, 0.22);
  /* Daily / reward highlight */
  --pop: #ffc53d;
  --pop-dim: rgba(255, 197, 61, 0.2);
  --line: rgba(255, 255, 255, 0.14);
  --ink: #111;
  --radius: 14px;
  --nav-h: 64px;
  --cta-ink: #ffffff;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  height: 100svh;
  margin: 0;
  overflow: hidden;
  /* background: #070708; */
  color: var(--text);
  font-family: Sora, Battambang, sans-serif;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
  user-select: none;
  -webkit-user-drag: none;
}

body {
  display: grid;
  place-items: center;
}

.shell {
  position: relative;
  width: min(100vw, calc(100svh * 9 / 16));
  height: 100svh;
  max-height: 100dvh;
  overflow: hidden;
  background: var(--bg);
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  padding-top: max(8px, env(safe-area-inset-top));
  padding-bottom: 0;
  min-height: 0;
  overflow: hidden;
}

.screen.is-active {
  display: flex;
}

/* —— Top —— */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 16px 8px;
  flex: 0 0 auto;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-name {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.streak-badge {
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--pop-dim);
  color: var(--pop);
  font-size: 12px;
  font-weight: 800;
}

.streak-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--pop);
  box-shadow: 0 0 0 2px var(--pop-dim);
}

.topbar-title {
  font-size: 15px;
  font-weight: 700;
}

.ghost-btn {
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.ghost-btn:active {
  color: var(--text);
  background: var(--elevated);
}

/* Daily prompt — return visit hook */
.prompt-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 12px 6px;
  padding: 8px 10px;
  border-radius: 12px;
  background: #1e1e24;
  border: 1px solid rgba(255, 255, 255, 0.16);
  text-align: left;
  flex: 0 0 auto;
}

.prompt-chip:active {
  border-color: var(--orange);
}

.prompt-chip-label {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--orange-dim);
  color: var(--orange);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.prompt-chip-text {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: Battambang, Sora, sans-serif;
}

.prompt-chip-action {
  flex: 0 0 auto;
  color: var(--pop);
  font-size: 12px;
  font-weight: 800;
}

/* —— Stage —— */
.stage {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 0;
  background: var(--stage);
  border-block: 1px solid rgba(0, 0, 0, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.canvas-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--stage-deep);
}

#memeCanvas {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  touch-action: none;
  background: #2f3035;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  pointer-events: none;
  background: var(--stage);
}

.empty-state.is-hidden {
  display: none;
}

.empty-plus {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  margin-bottom: 4px;
  border-radius: 18px;
  border: 2px solid rgba(255, 255, 255, 0.55);
  background: var(--orange);
  color: #fff;
  font-size: 40px;
  font-weight: 500;
  line-height: 1;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.25);
}

.empty-state strong {
  font-size: 16px;
  font-weight: 800;
}

.empty-state span {
  display: none;
}

/* —— Workspace panels (draggable sheet) —— */
.workspace {
  position: relative;
  flex: 0 0 auto;
  flex-shrink: 0;
  background: var(--panel);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
  min-height: 0;
  max-height: none;
  overflow: visible;
  transition: box-shadow 0.2s ease;
}

.sheet-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 10px 16px 6px;
  touch-action: none;
  cursor: grab;
  flex: 0 0 auto;
  background: transparent;
  border: 0;
}

.sheet-handle:active {
  cursor: grabbing;
}

.sheet-handle-bar {
  display: block;
  width: 44px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
}

.workspace-body {
  overflow: hidden;
  max-height: 50vh;
  transition: max-height 0.22s ease, opacity 0.18s ease;
}

.workspace.is-collapsed .workspace-body {
  max-height: 0 !important;
  opacity: 0;
  pointer-events: none;
}

.workspace.is-collapsed .sheet-handle {
  padding: 8px 16px;
}

/* Collapsed sheet → maximize canvas */
#screen-editor.is-sheet-collapsed .prompt-chip {
  display: none;
}

#screen-editor.is-sheet-collapsed .topbar {
  padding-top: 4px;
  padding-bottom: 4px;
}

#screen-editor.is-sheet-collapsed .brand-name {
  font-size: 16px;
}

#screen-editor.is-sheet-collapsed .stage {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0;
}

#screen-editor.is-sheet-collapsed .canvas-wrap {
  width: 100%;
  height: 100%;
}

#screen-editor.is-sheet-collapsed #memeCanvas {
  box-shadow: none;
}

.workspace.is-dragging {
  box-shadow: 0 -12px 28px rgba(0, 0, 0, 0.45);
}

.workspace.is-dragging .sheet-handle-bar {
  background: var(--orange);
}


.panel {
  display: none;
  flex-direction: column;
  gap: 10px;
  padding: 12px 16px 10px;
}

#panel-bg.panel {
  gap: 10px;
  padding: 6px 14px 10px;
}

.panel.is-active {
  display: flex;
}

/* Captions tab: bigger canvas, tighter controls */
#screen-editor.is-cap-focus .prompt-chip {
  margin-bottom: 4px;
  padding: 8px 10px;
}

#screen-editor.is-cap-focus .prompt-chip-text {
  font-size: 12px;
}

#screen-editor.is-cap-focus .stage {
  flex: 1 1 auto;
  min-height: 0;
}

#screen-editor.is-cap-focus .workspace {
  min-height: 0;
  flex: 0 0 auto;
}

#screen-editor.is-cap-focus #panel-cap {
  gap: 6px;
  padding: 8px 12px 4px;
}

#screen-editor.is-cap-focus #panel-cap .panel-head {
  min-height: 28px;
}

#screen-editor.is-cap-focus #panel-cap .panel-head h2 {
  font-size: 11px;
}

#screen-editor.is-cap-focus .text-actions .primary-btn,
#screen-editor.is-cap-focus .secondary-btn--slim {
  height: 36px;
  font-size: 13px;
  border-radius: 10px;
}

#screen-editor.is-cap-focus .mini-btn {
  width: 32px;
  height: 32px;
}

#screen-editor.is-cap-focus .tool-ico {
  min-height: 42px;
  gap: 2px;
  padding: 4px 2px;
  font-size: 9px;
}

#screen-editor.is-cap-focus .tool-ico .tool-glyph {
  font-size: 14px;
}

#screen-editor.is-cap-focus .tool-detail {
  min-height: 0;
  margin: 0;
}

/* Typing: maximize canvas — hide chrome under the meme */
#screen-editor.is-typing .prompt-chip {
  display: none;
}

#screen-editor.is-typing .stage {
  min-height: 0;
  flex: 1 1 auto;
}

#screen-editor.is-typing #panel-cap .panel-head,
#screen-editor.is-typing #panel-cap .text-actions,
#screen-editor.is-typing #panel-cap .tool-row,
#screen-editor.is-typing #panel-cap .tool-detail {
  display: none !important;
}

#screen-editor.is-typing .workspace:not(.is-collapsed) .workspace-body {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

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

.panel-head--layout {
  align-items: center;
  justify-content: stretch;
  gap: 0;
}

.panel-head--layout .primary-btn--compact {
  width: 100%;
}

.panel-title-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
}

.panel-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.panel-hint {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--muted);
  font-family: Battambang, Sora, sans-serif;
}

.panel-hint--sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.primary-btn,
.secondary-btn {
  height: 44px;
  padding: 0 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 800;
}

.primary-btn--compact[hidden] {
  display: none !important;
}

.primary-btn {
  background: linear-gradient(180deg, #ff5a86 0%, var(--orange) 55%, #e02d5c 100%);
  color: var(--cta-ink);
  box-shadow: 0 4px 0 #a81f45, 0 8px 16px rgba(0, 0, 0, 0.28);
}

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

.primary-btn:active {
  filter: brightness(0.97);
  transform: translateY(2px);
  box-shadow: 0 2px 0 #a81f45, 0 4px 10px rgba(0, 0, 0, 0.22);
}

.secondary-btn {
  width: 100%;
  background: var(--elevated);
  color: var(--text);
  border: 1px solid var(--line);
}

.secondary-btn:active {
  border-color: var(--orange);
}

.layout-extras {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.layout-extras[hidden] {
  display: none !important;
}

.layout-extra-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.layout-extra-tabs:has(.layout-extra-tab[hidden]) {
  grid-template-columns: 1fr;
}

.layout-extra-tab {
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--elevated);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  font-family: Sora, Battambang, sans-serif;
}

.layout-extra-tab.is-active {
  border-color: var(--orange);
  background: var(--orange-dim);
  color: var(--orange);
}

.layout-extra-tab[hidden] {
  display: none !important;
}

.layout-extra-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.layout-extra-panel[hidden] {
  display: none !important;
}

.bg-border-btn,
.bg-clear-btn {
  height: 34px;
  font-size: 12px;
  font-weight: 700;
  padding: 0 12px;
  color: var(--muted);
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--elevated);
  flex: 0 0 auto;
  white-space: nowrap;
}

.bg-border-btn.is-active {
  color: var(--orange);
  border-color: var(--orange);
  background: var(--orange-dim);
}

.bg-clear-btn[hidden] {
  display: none !important;
}

.bg-label {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.bg-swatches {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 2px 0;
}

.bg-swatches::-webkit-scrollbar {
  display: none;
}

.bg-swatch {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.22);
  padding: 0;
  flex: 0 0 auto;
}

.bg-swatch.is-active {
  border-color: var(--orange);
  box-shadow: 0 0 0 2px var(--orange-dim);
}

.bg-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.bg-actions::-webkit-scrollbar {
  display: none;
}

#bgColorInput {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: transparent;
  flex: 0 0 auto;
  overflow: hidden;
  cursor: pointer;
}

#bgColorInput::-webkit-color-swatch-wrapper {
  padding: 0;
}

#bgColorInput::-webkit-color-swatch {
  border: 0;
  border-radius: 999px;
}

.bg-image-btn {
  height: 34px !important;
  min-width: 72px;
  padding: 0 14px !important;
  font-size: 12px !important;
  width: auto !important;
  border-radius: 999px !important;
  flex: 0 0 auto;
}

.layout-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  margin: 2px -4px 0;
  padding: 4px 4px 2px;
  scrollbar-width: none;
}

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

.layout-grid {
  display: grid;
  grid-template-columns: repeat(8, 56px);
  gap: 10px;
  width: max-content;
}

.temp-card {
  width: 56px;
  height: 56px;
  padding: 5px;
  border-radius: 12px;
  background: #2a2b30;
  border: 2px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
}

.temp-card svg {
  width: 100%;
  height: 100%;
  display: block;
}

.temp-card.is-selected {
  border-color: var(--orange);
  background: #32333a;
  box-shadow: 0 0 0 1px var(--orange), 0 2px 0 rgba(0, 0, 0, 0.4);
}

.history-mini {
  display: flex;
  gap: 6px;
}

.mini-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--elevated);
  color: var(--text);
  font-size: 18px;
  line-height: 1;
}

.mini-btn:disabled {
  opacity: 0.35;
}

.tool-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tool-row::-webkit-scrollbar {
  display: none;
}

.tool-row--icons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  overflow: visible;
}

.tool-ico {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 52px;
  padding: 6px 2px;
  border-radius: 10px;
  color: #d0d0d4;
  font-size: 10px;
  font-weight: 700;
  background: transparent;
  border: 0;
  opacity: 1;
}

.tool-ico .tool-glyph {
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
  color: #f0f0f2;
}

.tool-ico.is-active {
  color: var(--orange);
  background: var(--orange-dim);
}

.tool-ico.is-active .tool-glyph {
  color: var(--orange);
}

.tool-detail {
  min-height: 0;
}

.detail {
  display: none;
  align-items: center;
}

.detail.is-active {
  display: flex;
  width: 100%;
}

.detail[hidden] {
  display: none !important;
}

.detail input[type="range"] {
  width: 100%;
  accent-color: var(--orange);
}

.detail select,
.detail input[type="color"] {
  width: 100%;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: var(--elevated);
  padding: 0 10px;
}

.detail input[type="color"] {
  max-width: 72px;
  padding: 4px;
}

.text-actions {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 8px;
  align-items: center;
}

.photo-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.photo-actions[hidden] {
  display: none !important;
}

.photo-actions .secondary-btn--slim {
  height: 38px;
}

.motion-chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.motion-chips::-webkit-scrollbar {
  display: none;
}

.motion-chip {
  flex: 0 0 auto;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--elevated);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.motion-chip.is-active {
  border-color: var(--orange);
  background: var(--orange-dim);
  color: var(--orange);
}

.text-actions .primary-btn {
  width: 100%;
}

.secondary-btn--slim {
  height: 44px;
  width: 100%;
}

.text-overlay {
  position: absolute;
  z-index: 4;
  margin: 0;
  padding: 2px 6px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #fff;
  caret-color: var(--orange);
  text-align: center;
  font-weight: 900;
  line-height: 1.12;
  outline: 2px solid var(--orange);
  outline-offset: 4px;
  transform-origin: center center;
  -webkit-user-select: text;
  user-select: text;
  box-sizing: border-box;
  min-width: 2ch;
  max-width: 90%;
  resize: none;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-word;
  field-sizing: content;
}

.text-overlay[hidden] {
  display: none !important;
}

.text-overlay::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.export-hint {
  display: none;
}

.export-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

#panel-exp.panel {
  gap: 10px;
  padding: 10px 16px 12px;
}

#panel-cap .panel-head {
  justify-content: flex-end;
  min-height: 0;
}

/* —— Bottom nav —— */
.bottom-nav {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  flex: 0 0 auto;
  flex-shrink: 0;
  z-index: 30;
  min-height: 56px;
  padding-top: 4px;
  padding-bottom: max(6px, env(safe-area-inset-bottom, 0px));
  background: #0e0e10;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.nav-tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 48px;
  padding: 6px 4px 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}

.nav-ico {
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
}

.nav-tab.is-active {
  color: var(--orange);
}

.nav-tab.is-active::before {
  content: "";
  position: absolute;
  top: 0;
  left: 24%;
  right: 24%;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--orange);
}

/* —— Done / Gallery —— */
.done-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 16px;
  text-align: center;
}

.done-kicker {
  margin: 0;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--orange);
}

.done-title {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
}

.done-preview-wrap {
  width: min(78%, 340px);
  aspect-ratio: 1;
  border-radius: 16px;
  overflow: hidden;
  background: var(--stage);
  border: 1px solid rgba(255, 122, 24, 0.35);
}

.done-preview {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.done-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: min(92%, 380px);
}

.done-actions--row {
  margin-top: -4px;
}

.done-actions .primary-btn,
.done-actions .secondary-btn,
.done-actions .ghost-btn {
  width: 100%;
}

#screen-gallery {
  padding-inline: 16px;
}

.gallery-hint {
  display: none;
}

.gallery-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-content: start;
  padding-top: 8px;
  min-height: 0;
  overflow: auto;
}

.gallery-card {
  aspect-ratio: 1;
  border-radius: 14px;
  overflow: hidden;
  background: var(--stage);
}

.gallery-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-empty {
  margin: auto;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  font-family: Battambang, Sora, sans-serif;
}

.gallery-empty.is-hidden {
  display: none;
}

.toast {
  position: absolute;
  left: 50%;
  bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom));
  z-index: 40;
  max-width: 84%;
  transform: translate(-50%, 8px);
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(20, 20, 22, 0.96);
  border: 1px solid rgba(255, 122, 24, 0.35);
  font-family: Battambang, Sora, sans-serif;
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-height: 700px) {
  .prompt-chip {
    padding: 8px 10px;
    margin-bottom: 6px;
  }

  .empty-plus {
    width: 52px;
    height: 52px;
    font-size: 32px;
  }

  .layout-grid {
    grid-template-columns: repeat(8, 52px);
  }

  .temp-card {
    width: 52px;
    height: 52px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

/* —— Home / Settings —— */
.home-screen {
  padding: max(24px, env(safe-area-inset-top)) 20px max(14px, env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 88% 4%, rgba(255, 197, 61, 0.27), transparent 25%),
    radial-gradient(circle at -8% 58%, rgba(255, 61, 110, 0.24), transparent 36%),
    radial-gradient(circle at 105% 88%, rgba(111, 103, 255, 0.2), transparent 31%),
    linear-gradient(155deg, #2b3850 0%, #171d29 52%, #10141c 100%);
}

.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.home-header h1 {
  margin: 0;
  font-size: 40px;
  line-height: 0.95;
  letter-spacing: -0.05em;
  text-shadow: 0 5px 18px rgba(0, 0, 0, 0.32);
}

.home-icon-btn {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(255,255,255,.17), rgba(255,255,255,.07));
  border: 1px solid rgba(255,255,255,.2);
  box-shadow: 0 7px 18px rgba(0,0,0,.2);
  font-size: 21px;
}

.home-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
  min-height: 0;
}

.home-streak {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.home-streak strong {
  display: grid;
  place-items: center;
  min-width: 40px;
  height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--pop-dim);
  color: var(--pop);
  font-size: 16px;
}

.daily-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: 100%;
  min-height: 190px;
  padding: 22px;
  border-radius: 24px;
  text-align: left;
  background:
    linear-gradient(145deg, rgba(255,255,255,.2), transparent 42%),
    linear-gradient(145deg, #ff668d 0%, #e13b75 48%, #a82967 100%);
  border: 1px solid rgba(255,255,255,.2);
  box-shadow: 0 18px 38px rgba(7, 10, 18, .34);
  color: white;
}

.daily-card::before,
.daily-card::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  pointer-events: none;
}

.daily-card::before {
  width: 170px;
  height: 170px;
  right: -65px;
  top: -70px;
  background: rgba(255, 210, 91, .2);
}

.daily-card::after {
  width: 115px;
  height: 115px;
  right: 22px;
  bottom: -69px;
  border: 20px solid rgba(255,255,255,.08);
}

.daily-card:active { transform: scale(.985); }
.daily-label {
  display: inline-block;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(20,10,25,.24);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.daily-card strong {
  display: block;
  margin: 27px 0 22px;
  font-family: Battambang, Sora, sans-serif;
  font-size: clamp(25px, 6.6vw, 32px);
  line-height: 1.3;
  max-width: 92%;
}

.daily-cta {
  font-size: 16px;
  font-weight: 800;
}

.home-main-btn {
  min-height: 60px;
  width: 100%;
  border-radius: 17px;
  font-size: 18px;
  box-shadow: 0 9px 22px rgba(255, 61, 110, .23);
}

.continue-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 76px;
  padding: 14px 18px;
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(255,255,255,.12), rgba(255,255,255,.06));
  border: 1px solid rgba(255,255,255,.16);
  text-align: left;
}

.continue-card[hidden] { display: none; }
.continue-card span { display: flex; flex-direction: column; gap: 3px; }
.continue-card small { color: var(--muted); font-size: 12px; }
.continue-card strong { font-size: 16px; }
.continue-card b { color: var(--orange); font-size: 31px; }

.home-nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  min-height: 72px;
  border-radius: 21px;
  background: rgba(8, 11, 17, .76);
  border: 1px solid rgba(255,255,255,.15);
  box-shadow: 0 10px 25px rgba(0,0,0,.25);
}

.home-nav button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--muted);
}

.home-nav button span { font-size: 23px; line-height: 1; }
.home-nav button small { font-size: 12px; font-weight: 700; }
.home-nav button.is-active { color: var(--orange); }

.home-nav button.is-active::after {
  content: "";
  position: absolute;
  bottom: 5px;
  width: 26px;
  height: 3px;
  border-radius: 999px;
  background: currentColor;
}

.home-nav button { position: relative; }

.brand-home-btn {
  color: inherit;
  text-align: left;
}

.settings-screen {
  background: linear-gradient(160deg, #273146, #151a24 72%);
}

.settings-spacer { width: 62px; }
.settings-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
}

.settings-card,
.settings-info {
  padding: 16px;
  border-radius: 16px;
  background: rgba(255,255,255,.08);
  border: 1px solid var(--line);
}

.settings-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 700;
}

.settings-lang {
  display: flex;
  gap: 5px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(0,0,0,.25);
}

.settings-lang button {
  min-width: 52px;
  height: 34px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.settings-lang button.is-active {
  background: var(--orange);
  color: white;
}

.settings-info strong { font-size: 14px; }
.settings-info p {
  margin: 7px 0 0;
  color: var(--muted);
  font-family: Battambang, Sora, sans-serif;
  font-size: 12px;
  line-height: 1.6;
}

@media (max-height: 690px) {
  .home-screen {
    padding-top: max(15px, env(safe-area-inset-top));
  }

  .home-header h1 { font-size: 34px; }
  .home-content { gap: 10px; }
  .daily-card { min-height: 165px; padding: 18px 20px; }
  .daily-card strong { margin: 17px 0 13px; font-size: 23px; }
  .home-main-btn { min-height: 50px; }
  .continue-card { min-height: 62px; padding-block: 9px; }
  .home-nav { min-height: 62px; }
  .home-nav button span { font-size: 20px; }
  .home-nav button small { font-size: 11px; }
}
