:root {
  color-scheme: light;
  --paper: #faf7f2;
  --card: #ffffff;
  --ink: #2b2a28;
  --muted: #8a857c;
  --line: #e8e2d8;
  --accent: #d9653b;
  --accent-ink: #ffffff;
  --theirs: #efeae2;
  --danger: #d93b3b;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--paper); color: var(--ink); font-family: var(--font); }
body { position: fixed; inset: 0; overflow: hidden; overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.screen {
  position: fixed; left: 0; right: 0; top: 0;
  height: var(--app-h, 100%);
  display: flex; flex-direction: column;
  padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right);
}

.primary {
  border: 0; border-radius: 14px; padding: 15px 18px; width: 100%;
  background: var(--accent); color: var(--accent-ink); font-size: 17px; font-weight: 600;
  transition: transform .1s, opacity .2s;
}
.primary:active { transform: scale(.98); opacity: .9; }
.primary:disabled { opacity: .5; }

/* =================================================== Appli « Souvenirs » */
#home { padding-top: env(safe-area-inset-top); padding-bottom: calc(14px + env(safe-area-inset-bottom)); max-width: 560px; margin: 0 auto; }
.home-head { display: flex; align-items: baseline; justify-content: space-between; padding: 14px 20px 6px; }
.home-head h1 { margin: 0; font-size: 32px; font-weight: 800; letter-spacing: -.02em; }
.text-btn { border: 0; background: none; color: var(--accent); font-size: 16px; padding: 6px 0; }

.stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 10px 24px 14px; }
.stage canvas {
  max-width: 100%; max-height: 100%; width: auto; height: auto; display: block;
  border-radius: 6px; background: #fff;
  box-shadow: 0 1px 2px rgba(60, 40, 20, .08), 0 12px 32px rgba(60, 40, 20, .16);
  transform: rotate(-1.2deg);
}

.controls { flex: none; display: flex; flex-direction: column; gap: 12px; padding: 0 20px; }
.frames { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -20px; padding: 2px 20px; }
.frames::-webkit-scrollbar { display: none; }
.frames button {
  flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 999px;
  padding: 8px 15px; font-size: 15px; white-space: nowrap;
}
.frames button.sel { background: var(--ink); border-color: var(--ink); color: #fff; }

.row { display: flex; gap: 10px; }
.pick {
  flex: none; display: flex; align-items: center; gap: 6px; padding: 0 14px;
  border: 1px solid var(--line); background: var(--card); border-radius: 12px; color: var(--accent); font-weight: 600;
}
.caption {
  flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--card); border-radius: 12px;
  padding: 12px 14px; font-size: 16px; outline: none;
}
.caption:focus { border-color: var(--accent); }
.toggle { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--muted); }
.toggle input { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; }

/* =================================================== Notification */
.toast {
  position: fixed; z-index: 40; left: 50%; top: calc(env(safe-area-inset-top) + 12px); transform: translateX(-50%);
  background: rgba(43, 42, 40, .92); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px;
  max-width: calc(100% - 32px); text-align: center; pointer-events: none;
}
