/* noel.kigane.com — nuit de Noël, lettre sur papier crème */
:root {
  --night: #0b1a2e;
  --night-2: #12284a;
  --paper: #fbf6ea;
  --paper-2: #f3ebd8;
  --rule: #e2d8c4;
  --ink: #26222e;
  --ink-soft: #6a6276;
  --red: #c0392b;
  --red-2: #e04e3f;
  --green: #1f6f4a;
  --green-2: #2f8f62;
  --gold: #e2b857;
  --snow: #ffffff;
  --twitch: #9146ff;
  --twitch-2: #772ce8;
  --sky-text: #e9eef7;
  --sky-muted: #a9b6cc;
  --radius: 14px;
  --wrap: 1080px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--sky-text);
  background: radial-gradient(1200px 600px at 50% -200px, #1d3a66 0%, var(--night-2) 40%, var(--night) 75%);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.55;
}
a { color: var(--gold); text-decoration-color: rgba(226,184,87,.5); }
a:hover { text-decoration-color: var(--gold); }
.hand { font-family: "Caveat", "Segoe Print", "Bradley Hand", cursive; }
.ic { vertical-align: -0.15em; }
.wrap { width: min(var(--wrap), 100%); margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* Décor */
.snow { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.snow span { position: absolute; top: -12px; width: 6px; height: 6px; border-radius: 50%; background: var(--snow); opacity: .75; filter: blur(.2px); animation: fall linear infinite; }
@keyframes fall { to { transform: translate3d(var(--dx, 0), 110vh, 0); } }
@media (prefers-reduced-motion: reduce) { .snow { display: none; } html { scroll-behavior: auto; } }
.hills { position: fixed; left: 0; right: 0; bottom: 0; height: 160px; z-index: 0; pointer-events: none;
  background:
    radial-gradient(60% 120px at 20% 100%, #e9eef7 50%, transparent 51%),
    radial-gradient(70% 150px at 70% 100%, #f7f9fd 50%, transparent 51%),
    radial-gradient(50% 100px at 100% 100%, #dfe6f2 50%, transparent 51%);
  opacity: .08; }

/* En-tête */
.top { position: relative; z-index: 2; padding-block: 14px; }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; color: #fff; text-decoration: none; font-size: 1.05rem; letter-spacing: .01em; }
.brand-ic { color: var(--gold); font-size: 1.3em; }
.nav { display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap; }
.nav > a { color: var(--sky-muted); text-decoration: none; font-weight: 600; padding: 6px 4px; border-bottom: 2px solid transparent; }
.nav > a.on, .nav > a:hover { color: #fff; border-color: var(--gold); }
.user-chip { display: inline-flex; align-items: center; gap: 8px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); border-radius: 999px; padding: 4px 6px 4px 6px; margin: 0; }
.user-chip img { border-radius: 50%; display: block; }
.user-chip span { font-weight: 700; font-size: .92rem; }
.user-chip button { border: 0; background: transparent; color: var(--sky-muted); cursor: pointer; display: inline-flex; padding: 4px; border-radius: 50%; }
.user-chip button:hover { color: #fff; background: rgba(255,255,255,.1); }

/* Boutons */
.btn { display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; padding: 10px 18px; font-weight: 800; font-size: .95rem; text-decoration: none; border: 2px solid transparent; cursor: pointer; line-height: 1.2; transition: transform .12s ease, background .15s ease; font-family: inherit; }
.btn:active { transform: translateY(1px); }
.btn.big { padding: 14px 24px; font-size: 1.05rem; }
.btn.small { padding: 7px 14px; font-size: .85rem; }
.btn.primary { background: var(--red); color: #fff; box-shadow: 0 6px 18px rgba(192,57,43,.35); }
.btn.primary:hover { background: var(--red-2); }
.btn.twitch { background: var(--twitch); color: #fff; }
.btn.twitch:hover { background: var(--twitch-2); }
.btn.ghost { background: transparent; color: inherit; border-color: currentColor; opacity: .9; }
.btn.ghost:hover { opacity: 1; background: rgba(127,127,127,.12); }
.btn.danger { background: transparent; color: var(--red); border-color: var(--red); }
.btn.danger:hover { background: rgba(192,57,43,.1); }

/* Héros */
.main { position: relative; z-index: 1; padding-block: 18px 80px; }
.hero { text-align: center; padding-block: 36px 10px; max-width: 760px; margin: 0 auto; }
.hero.compact { padding-block: 22px 6px; }
.kicker { color: var(--gold); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; font-size: .78rem; margin: 0 0 10px; }
.hero h1 { font-family: "Caveat", cursive; font-weight: 700; font-size: clamp(2.6rem, 7vw, 4.6rem); line-height: 1; margin: 0 0 14px; color: #fff; text-wrap: balance; text-shadow: 0 4px 30px rgba(0,0,0,.35); }
.lead { font-size: 1.1rem; color: var(--sky-muted); margin: 0 auto 18px; max-width: 60ch; }
.hero-actions { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.or { color: var(--sky-muted); font-size: .92rem; }
.pill { display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; padding: 8px 14px; background: rgba(47,143,98,.18); border: 1px solid rgba(47,143,98,.5); color: #d8f3e5; font-size: .92rem; }
.counter { color: var(--sky-muted); margin: 0; }
.counter strong { color: #fff; }

/* Avis */
.notice { position: relative; z-index: 1; max-width: 820px; margin: 14px auto; padding: 12px 16px; border-radius: var(--radius); background: rgba(226,184,87,.12); border: 1px solid rgba(226,184,87,.45); color: #fff5dc; }
.notice.soft { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.14); color: var(--sky-text); }
.notice.ok { background: rgba(47,143,98,.16); border-color: rgba(47,143,98,.55); color: #d8f3e5; }
.notice.error { background: rgba(192,57,43,.14); border-color: rgba(224,78,63,.6); color: #ffe3df; }
.notice ul { margin: 6px 0 0; padding-left: 20px; }
.notice.big-notice { font-size: 1.05rem; }

/* La lettre (papier) */
.paper-wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; align-items: start; max-width: 820px; margin: 22px auto 0; }
.page-letter .paper-wrap { grid-template-columns: minmax(0, 1fr) 280px; max-width: 1040px; }
.paper { position: relative; background: var(--paper); color: var(--ink); border-radius: 6px; padding: 42px 44px 36px; box-shadow: 0 30px 60px rgba(0,0,0,.45), 0 2px 0 #fff inset; border-top: 10px solid var(--red); min-width: 0;
  background-image: repeating-linear-gradient(transparent 0 35px, var(--rule) 35px 36px); background-attachment: local; background-position: 0 14px; }
.paper::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: var(--gold); }
.paper .line { font-size: 1.08rem; line-height: 36px; margin: 0 0 12px; }
.paper .hand.date { color: var(--ink-soft); font-size: 1.25rem; margin: 0 120px 6px 0; text-align: right; }
.paper .hand.salute { font-size: 2.1rem; font-weight: 700; color: var(--red); margin: 0 0 8px; line-height: 1.2; }
.paper .hand.val { font-size: 1.35rem; font-weight: 700; color: var(--green); font-style: normal; }
.paper .hand.sign { font-size: 1.35rem; margin: 18px 0 0; line-height: 1.5; }
.paper .sig { font-size: 1.6rem; font-weight: 700; color: var(--green); display: inline-flex; align-items: center; gap: 6px; }
.paper .sig .tw { color: var(--twitch); font-size: .8em; }
.paper .avatar { position: absolute; left: 24px; top: -28px; border-radius: 50%; border: 4px solid var(--paper); box-shadow: 0 6px 16px rgba(0,0,0,.25); background: var(--paper-2); }
.stamp { position: absolute; right: 28px; top: 24px; width: 84px; height: 104px; background: var(--green); color: var(--paper); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; font-weight: 800; font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; transform: rotate(6deg); outline: 4px dashed var(--paper); outline-offset: -8px; box-shadow: 0 4px 10px rgba(0,0,0,.2); }
.stamp-year { font-family: "Caveat", cursive; font-size: 1.6rem; color: var(--gold); text-transform: none; letter-spacing: 0; line-height: 1; margin: 4px 0; }
.blank { display: inline-block; min-width: 10ch; border-bottom: 2px dotted var(--ink-soft); vertical-align: baseline; }
.blank.sel { min-width: 0; }
.blank.filled { min-width: 0; padding: 0 .35em; }
.paper .pseudo { font-size: 1.45rem; font-weight: 700; color: var(--green); white-space: nowrap; }
.paper.locked { position: relative; }
.paper.locked .paper-fields { opacity: .45; filter: saturate(.6); pointer-events: none; user-select: none; }
.paper-fields { border: 0; padding: 0; margin: 0; min-width: 0; }
.paper-lock { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); z-index: 3; width: min(92%, 440px); background: #fffdf7; border: 2px dashed var(--green); border-radius: 14px; padding: 22px 24px; text-align: center; box-shadow: 0 12px 34px rgba(0,0,0,.18); }
.paper-lock p { margin: 0 0 14px; font-size: 1.02rem; line-height: 1.45; color: var(--ink); }
.paper-lock p svg { width: 20px; height: 20px; vertical-align: -4px; color: var(--twitch); }
.paper-lock strong { display: block; font-size: 1.15rem; margin-bottom: 4px; }
@media (max-width: 640px) { .paper-lock { position: sticky; top: 12px; left: auto; transform: none; width: auto; margin: 0 0 12px; } }
.inline { border: 0; background: transparent; padding: 0 4px; font-size: 1.35rem; font-weight: 700; color: var(--green); width: 100%; min-width: 10ch; outline: none; font-family: inherit; }
.inline::placeholder { color: #a39b8e; font-weight: 500; }
.inline:focus { background: rgba(226,184,87,.18); border-radius: 4px; }
select.inline { width: auto; max-width: 100%; appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 20px; background: transparent url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M6 9l6 6 6-6' fill='none' stroke='%231f6f4a' stroke-width='2.5' stroke-linecap='round'/></svg>") no-repeat right 2px center / 14px; }
.blank:has(.inline) { min-width: 12ch; }
input.inline { width: auto; min-width: 12ch; }

.wishes { list-style: none; margin: 4px 0 6px; padding: 0; }
.wish { display: grid; grid-template-columns: 2.2ch minmax(0, 1fr) auto; gap: 8px; align-items: start; padding: 4px 0; }
.wish .num { font-family: "Caveat", cursive; font-size: 1.4rem; font-weight: 700; color: var(--red); line-height: 36px; }
.wish-fields { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wish-name { border: 0; background: transparent; font-size: 1.35rem; font-weight: 700; color: var(--ink); width: 100%; outline: none; line-height: 36px; padding: 0 4px; border-bottom: 2px dotted transparent; }
input.wish-name { border-bottom-color: var(--ink-soft); }
input.wish-name:focus { background: rgba(226,184,87,.18); border-radius: 4px; }
input.wish-name::placeholder { color: #a39b8e; font-weight: 500; }
.wish-link { display: flex; align-items: center; gap: 6px; color: var(--ink-soft); font-size: .9rem; padding: 0 4px; }
.wish-link input { border: 0; border-bottom: 1px solid transparent; background: transparent; font-family: inherit; font-size: .9rem; width: 100%; outline: none; color: var(--ink); padding: 3px 0; line-height: 26px; }
.wish-link input::placeholder { color: #a39b8e; }
.wish-link input:focus { border-bottom-color: var(--green); }
.wish .rm { border: 0; background: transparent; color: var(--ink-soft); cursor: pointer; display: inline-flex; padding: 6px; border-radius: 50%; margin-top: 6px; }
.wish .rm:hover { background: rgba(192,57,43,.12); color: var(--red); }
.wishes.read .wish .rm { display: none; }
.wishes.read .wish-name { font-size: 1.4rem; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 800; color: var(--green); background: rgba(31,111,74,.1); border: 1px solid rgba(31,111,74,.35); border-radius: 999px; padding: 3px 10px; text-decoration: none; width: fit-content; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip:hover { background: rgba(31,111,74,.18); }
.add-row { display: flex; align-items: center; gap: 12px; margin: 4px 0 14px; }
.paper .btn.ghost { color: var(--green); }
.muted { color: var(--ink-soft); font-size: .9rem; }
.msg { width: 100%; border: 0; border-bottom: 2px dotted var(--ink-soft); background: transparent; font-size: 1.3rem; line-height: 36px; color: var(--ink); resize: vertical; outline: none; padding: 0 4px; min-height: 72px; }
.msg:focus { background: rgba(226,184,87,.18); border-radius: 4px; }
.msg::placeholder { color: #a39b8e; }
.msg-read { font-size: 1.35rem; line-height: 36px; margin: 0 0 8px; white-space: pre-wrap; }
.check { display: flex; align-items: flex-start; gap: 10px; margin: 20px 0 14px; font-size: .95rem; color: var(--ink); cursor: pointer; line-height: 1.4; }
.check input { width: 18px; height: 18px; accent-color: var(--green); margin-top: 2px; flex: none; }
.actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.hp { position: absolute; left: -9999px; top: -9999px; height: 0; overflow: hidden; }

/* Partage (page lettre) */
.share { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 10px; position: sticky; top: 16px; }
.share h2 { font-family: "Caveat", cursive; font-size: 1.8rem; margin: 0; color: #fff; }
.share hr { border: 0; border-top: 1px solid rgba(255,255,255,.12); margin: 6px 0; width: 100%; }
.share-row { display: flex; flex-wrap: wrap; gap: 8px; }
.share-row form { margin: 0; }
.share .btn { justify-content: center; }
.share .btn.ghost { color: var(--sky-text); border-color: rgba(255,255,255,.3); }
.share .fine { margin: 0; }
.link-more { color: var(--sky-muted); text-decoration: none; font-weight: 700; display: inline-flex; gap: 6px; align-items: center; }
.link-more:hover { color: #fff; }
.fine { font-size: .85rem; color: var(--sky-muted); }

/* Comment ça marche */
.how { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; max-width: 920px; margin: 40px auto 0; }
.how-card { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); border-radius: var(--radius); padding: 18px; }
.how-card .ic { font-size: 1.6rem; color: var(--gold); }
.how-card h3 { margin: 8px 0 4px; font-size: 1.05rem; color: #fff; }
.how-card p { margin: 0; color: var(--sky-muted); font-size: .95rem; }

/* Sapin (grille de lettres) */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; margin-top: 22px; }
.card { position: relative; display: block; background: var(--paper); color: var(--ink); border-radius: 6px; padding: 18px 16px 14px; text-decoration: none; border-top: 6px solid var(--red); box-shadow: 0 14px 30px rgba(0,0,0,.35); transition: transform .15s ease, box-shadow .15s ease; min-width: 0; }
.card:hover { transform: translateY(-4px) rotate(-.4deg); box-shadow: 0 22px 40px rgba(0,0,0,.45); }
.card .hook { position: absolute; top: -18px; left: 50%; width: 2px; height: 14px; background: var(--gold); transform: translateX(-50%); }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.card-head img, .initial { width: 40px; height: 40px; border-radius: 50%; flex: none; }
.initial { display: inline-flex; align-items: center; justify-content: center; background: var(--green); color: #fff; font-weight: 800; font-size: 1.1rem; }
.card .name { font-size: 1.45rem; color: var(--green); display: block; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .meta { font-size: .8rem; color: var(--ink-soft); }
.mini { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: .92rem; }
.mini li { display: flex; gap: 6px; align-items: baseline; min-width: 0; }
.mini li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini .ic { color: var(--red); flex: none; }
.mini .more { color: var(--ink-soft); font-style: italic; }
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 26px; color: var(--sky-muted); }
.pager .btn.ghost { color: var(--sky-text); border-color: rgba(255,255,255,.3); }

/* Atelier (admin) */
.admin-tools { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.admin-tools input { border-radius: 999px; border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.08); color: #fff; padding: 9px 14px; font-family: inherit; min-width: 220px; }
.table-wrap { overflow-x: auto; margin-top: 18px; border-radius: var(--radius); border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.04); }
table.admin { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 900px; }
table.admin th, table.admin td { padding: 10px 12px; border-bottom: 1px solid rgba(255,255,255,.08); vertical-align: top; text-align: left; }
table.admin th { color: var(--gold); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }
table.admin tr.is-hidden { opacity: .5; }
table.admin .meta { color: var(--sky-muted); font-size: .8rem; }
.admin-wishes { margin: 0; padding-left: 18px; display: grid; gap: 3px; }
.admin-wishes .chip { margin-left: 6px; vertical-align: middle; color: #cfe9db; background: rgba(47,143,98,.18); border-color: rgba(47,143,98,.5); }
.msg-cell { max-width: 260px; color: var(--sky-muted); }
.nowrap { white-space: nowrap; }
.inline-form { display: inline-block; margin: 0 4px 4px 0; }
.inline-form .btn.ghost { color: var(--sky-text); border-color: rgba(255,255,255,.3); }

/* Pied */
.foot { position: relative; z-index: 1; padding-block: 24px 36px; color: var(--sky-muted); font-size: .92rem; border-top: 1px solid rgba(255,255,255,.08); background: rgba(0,0,0,.18); }
.foot p { margin: 0 0 6px; }
.foot .fine { font-size: .82rem; }
.error-page { padding-block: 70px 40px; }

/* Petits écrans */
@media (max-width: 860px) {
  .page-letter .paper-wrap { grid-template-columns: minmax(0, 1fr); }
  .share { position: static; }
  .how { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .paper { padding: 34px 20px 26px; }
  .paper .line { font-size: 1rem; }
  .stamp { width: 64px; height: 80px; right: 14px; top: 14px; font-size: .55rem; }
  .stamp-year { font-size: 1.2rem; }
  .paper .hand.date { margin-right: 70px; font-size: 1.05rem; }
  .wish { grid-template-columns: 2ch minmax(0, 1fr) auto; }
  .hero h1 { font-size: 2.6rem; }
  .nav { width: 100%; justify-content: center; }
}
