/* Mitten Name Craft — thème d'hiver (bleu glacier) */
@font-face {
  font-family: "Andika";
  src: url("/assets/Andika-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

:root {
  --ice-50: #f3f9fe;
  --ice-100: #e3f1fb;
  --ice-200: #c7e3f6;
  --ice-300: #9fd0f0;
  --ice-500: #4a9fd8;
  --ice-700: #1f5f96;
  --ink: #1d2b3a;
  --muted: #5b6b7c;
  --white: #ffffff;
  --warn: #b3261e;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(31, 95, 150, 0.14);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { background: var(--ice-200); }
[hidden] { display: none !important; }
body {
  font-family: "Andika", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 700;
  color: var(--ink);
  min-height: 100vh;
  background: radial-gradient(1200px 600px at 20% -10%, #ffffff 0%, transparent 60%),
              linear-gradient(180deg, var(--ice-100) 0%, var(--ice-200) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

/* flocons qui tombent */
.snow { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.flake {
  position: absolute; top: -24px; color: #ffffff;
  text-shadow: 0 0 4px rgba(74, 159, 216, .55);
  animation: fall linear infinite;
  user-select: none;
}
@keyframes fall {
  0%   { transform: translate3d(0, -24px, 0) rotate(0deg); }
  50%  { transform: translate3d(18px, 52vh, 0) rotate(160deg); }
  100% { transform: translate3d(-10px, 106vh, 0) rotate(330deg); }
}
@media (prefers-reduced-motion: reduce) {
  .flake { animation: none; display: none; }
}

.wrap { position: relative; z-index: 1; max-width: 1180px; margin: 0 auto; padding: 22px 18px 40px; }

header.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand svg { width: 44px; height: 44px; flex: none; }
.brand h1 { font-size: 1.55rem; margin: 0; color: var(--ice-700); letter-spacing: .2px; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: .9rem; }

.lang-switch { display: inline-flex; background: var(--white); border-radius: 999px; padding: 4px; box-shadow: var(--shadow); }
.lang-switch button {
  border: 0; background: transparent; font: inherit; color: var(--muted);
  padding: 6px 14px; border-radius: 999px; cursor: pointer;
}
.lang-switch button[aria-pressed="true"] { background: var(--ice-700); color: var(--white); }

.card { background: rgba(255, 255, 255, .93); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }

/* page d'accès */
.login { max-width: 460px; margin: 9vh auto 0; text-align: center; }
.login .mitten-icon { width: 92px; height: 92px; margin: 0 auto 6px; display: block; }
.login h2 { margin: 6px 0 4px; font-size: 1.5rem; color: var(--ice-700); }
.login p { color: var(--muted); margin: 0 0 18px; }
.login form { display: grid; gap: 10px; text-align: left; }
label { font-size: .95rem; }
input[type="text"], input[type="password"] {
  width: 100%; font: inherit; font-size: 1.15rem; padding: 12px 14px; border-radius: 12px;
  border: 2px solid var(--ice-200); background: var(--ice-50); color: var(--ink); outline: none;
}
input[type="text"]:focus, input[type="password"]:focus { border-color: var(--ice-500); background: #fff; }
.btn {
  font: inherit; font-size: 1.05rem; border: 0; border-radius: 12px; padding: 12px 18px; cursor: pointer;
  background: var(--ice-700); color: #fff; box-shadow: 0 6px 14px rgba(31, 95, 150, .25);
}
.btn:hover { background: #184e7c; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.msg { min-height: 1.3em; font-size: .95rem; color: var(--muted); }
.msg.warn { color: var(--warn); }
.help { font-size: .85rem; color: var(--muted); margin-top: 12px; }

/* générateur */
.layout { display: grid; grid-template-columns: 360px 1fr; gap: 20px; margin-top: 18px; align-items: start; }
@media (max-width: 920px) { .layout { grid-template-columns: 1fr; } }
.controls { display: grid; gap: 16px; position: sticky; top: 14px; }
@media (max-width: 920px) { .controls { position: static; } }
fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
legend { padding: 0; margin-bottom: 6px; font-size: .95rem; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label {
  padding: 8px 12px; border-radius: 10px; background: var(--ice-50); border: 2px solid var(--ice-200);
  cursor: pointer; font-size: .92rem;
}
.seg input:checked + label { background: var(--ice-700); border-color: var(--ice-700); color: #fff; }
.seg input:focus-visible + label { outline: 3px solid var(--ice-300); }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches input { position: absolute; opacity: 0; pointer-events: none; }
.swatches label { width: 32px; height: 32px; border-radius: 50%; cursor: pointer; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--ice-200); }
.swatches input:checked + label { box-shadow: 0 0 0 3px var(--ice-700); }
.swatches input:focus-visible + label { outline: 3px solid var(--ice-300); }
.hint { font-size: .85rem; color: var(--muted); }
.count { font-size: .85rem; color: var(--muted); text-align: right; }

.previews { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .previews { grid-template-columns: 1fr; } }
.sheet { background: #fff; border-radius: 6px; box-shadow: 0 8px 22px rgba(29, 43, 58, .16); overflow: hidden; }
.sheet svg { display: block; width: 100%; height: auto; }
.sheet-label { text-align: center; font-size: .85rem; color: var(--muted); margin-top: 6px; }
.empty { display: grid; place-items: center; aspect-ratio: 210 / 297; color: var(--muted); padding: 20px; text-align: center; }

.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.actions .btn { flex: 1; }
.linkish { background: none; border: 0; font: inherit; color: var(--muted); text-decoration: underline; cursor: pointer; padding: 4px; }
footer { text-align: center; color: var(--muted); font-size: .8rem; margin-top: 26px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
