@import url('https://fonts.googleapis.com/css2?family=Klee+One:wght@400;600&family=Zen+Old+Mincho:wght@400;600&family=Zen+Kaku+Gothic+New:wght@300;400&display=swap');

:root {
  --ciel: #0B1024;
  --encre: #EAEEFF;
  --doux: rgba(234, 238, 255, .55);
  --pale: rgba(234, 238, 255, .32);
  --or: #E9C16B;
  --fil: #D4574E;
  --etoile: #FFEFCE;
  --eteinte: #3E4A7A;
  --fond-haut: radial-gradient(85% 45% at 82% 6%, rgba(233,193,107,.13) 0%, rgba(233,193,107,0) 60%),
               radial-gradient(130% 60% at 14% 104%, rgba(54,72,140,.32) 0%, rgba(54,72,140,0) 66%);
}
:root[data-quand="jour"] {
  --ciel: #FAF0E4;
  --encre: #23283F;
  --doux: rgba(35, 40, 63, .6);
  --pale: rgba(35, 40, 63, .4);
  --or: #A8632B;
  --fil: #B23A2E;
  --etoile: #B9812A;
  --eteinte: rgba(35, 40, 63, .22);
  --fond-haut: radial-gradient(95% 42% at 78% 2%, rgba(240,183,150,.5) 0%, rgba(240,183,150,0) 62%),
               radial-gradient(120% 55% at 10% 100%, rgba(196,205,232,.42) 0%, rgba(196,205,232,0) 64%);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  background-color: var(--ciel);
  background-image: var(--fond-haut);
  background-attachment: fixed;
  color: var(--encre);
  font-family: 'Zen Kaku Gothic New', system-ui, sans-serif;
  font-weight: 300;
  transition: background-color .8s ease, color .8s ease;
}
.hand { font-family: 'Klee One', 'Hiragino Mincho ProN', serif; }
.serif { font-family: 'Zen Old Mincho', serif; }
.wrap { max-width: 480px; margin: 0 auto; padding: 0 22px 96px; }
.mini { font-size: 9.5px; letter-spacing: .26em; color: var(--pale); }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

/* --- la porte ----------------------------------------------------------- */
#porte { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 34px; padding: 24px; text-align: center; }
#porte .q { font-size: 22px; line-height: 1.5; max-width: 300px; }
.cases-code { display: flex; align-items: flex-end; gap: 6px; }
.cases-code input {
  width: 38px; height: 52px; padding: 0 0 8px; text-align: center;
  font-family: 'Klee One', serif; font-size: 24px; color: var(--encre);
  background: rgba(128,128,128,.05); border: 0; border-bottom: 1px solid var(--or);
  border-radius: 3px 3px 0 0; outline: none;
}
.cases-code span { padding-bottom: 14px; color: var(--or); opacity: .6; }
#porte .indice { font-size: 11.5px; line-height: 1.65; color: var(--pale); max-width: 250px; }
.tremble { animation: tremble .35s; }
@keyframes tremble { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* --- le ciel ------------------------------------------------------------ */
.entete { display: flex; flex-direction: column; gap: 16px; padding-top: 38px; }
.entete .mot { font-size: 25px; line-height: 1.42; max-width: 280px; }
.entete .sous { font-size: 12px; line-height: 1.6; color: var(--doux); max-width: 270px; }
.lune { position: absolute; right: 20px; top: 26px; }

#constellation { display: block; width: 100%; height: auto; margin: 14px 0 4px; overflow: visible; }
#constellation .fil { fill: none; stroke: var(--fil); stroke-width: 1.3; stroke-linecap: round; opacity: .85; }
#constellation .off { fill: var(--eteinte); opacity: .55; }
#constellation .on  { fill: var(--etoile); filter: url(#lueur); }
#constellation .num { font-family: 'Zen Kaku Gothic New', sans-serif; font-size: 7.5px; fill: var(--encre); fill-opacity: .38; text-anchor: middle; }
#constellation .today { fill: var(--etoile); filter: url(#lueur); animation: battement 3.2s ease-in-out infinite; }
#constellation .aura { fill: var(--or); opacity: .2; animation: aura 3.2s ease-in-out infinite; }
#constellation .cliquable { cursor: pointer; }
@keyframes battement { 50% { r: 5.6; } }
@keyframes aura { 50% { r: 15px; opacity: .06; } }

.actions { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 6px; }
.bouton {
  display: inline-flex; align-items: center; gap: 10px; padding: 13px 26px; border-radius: 999px;
  font-family: 'Zen Old Mincho', serif; font-size: 15px;
  border: 1px solid color-mix(in srgb, var(--or) 55%, transparent);
  background: color-mix(in srgb, var(--or) 14%, transparent);
  transition: transform .15s ease;
}
.bouton:active { transform: scale(.97); }
[data-quand="jour"] .bouton { background: var(--encre); color: var(--ciel); border-color: transparent; }

.barre {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 480px; margin: 0 auto; padding: 12px 22px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--ciel) 62%, transparent);
  font-size: 12px; color: var(--doux);
}
.barre button { display: flex; align-items: center; gap: 7px; }
.pastille { min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--fil); color: #fff; font-size: 10px; display: grid; place-items: center; }

/* --- une case ouverte ---------------------------------------------------- */
.voile { position: fixed; inset: 0; z-index: 10; background: var(--ciel); overflow-y: auto; animation: monte .45s ease; }
@keyframes monte { from { transform: translateY(14px); opacity: 0; } }
.voile .haut { display: flex; align-items: center; justify-content: space-between; padding: 24px 22px 0; }
.polaroid { display: block; margin: 20px auto 0; width: min(320px, 86%); background: #F6F1E6; padding: 11px 11px 0; transform: rotate(-1.4deg); box-shadow: 0 18px 30px -18px rgba(0,0,0,.6); }
.polaroid img { display: block; width: 100%; }
.polaroid .leg { font-family: 'Klee One', serif; font-size: 14px; color: #3A3527; padding: 9px 3px 11px; }
.texte { font-family: 'Klee One', serif; font-size: 16.5px; line-height: 1.58; padding: 24px 26px 0; white-space: pre-line; }
.audio { display: flex; align-items: center; gap: 12px; margin: 24px 26px 0; padding: 10px 16px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--encre) 12%, transparent); }
.audio audio { width: 100%; }

/* --- le chat ------------------------------------------------------------- */
.tiroir { position: fixed; inset: auto 0 0 0; z-index: 20; max-width: 480px; margin: 0 auto; height: 78dvh;
  background: var(--ciel); border-top: 1px solid color-mix(in srgb, var(--or) 30%, transparent);
  border-radius: 14px 14px 0 0; display: flex; flex-direction: column; animation: monte .3s ease; }
.tiroir .fil-msg { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.bulle { max-width: 78%; padding: 9px 13px; border-radius: 14px; font-size: 14px; line-height: 1.45; }
.bulle.elle { align-self: flex-end; background: color-mix(in srgb, var(--or) 20%, transparent); border-bottom-right-radius: 4px; }
.bulle.lui { align-self: flex-start; background: color-mix(in srgb, var(--encre) 8%, transparent); border-bottom-left-radius: 4px; }
.saisie { display: flex; gap: 8px; padding: 12px 14px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid color-mix(in srgb, var(--encre) 10%, transparent); }
.saisie input { flex: 1; padding: 11px 14px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--encre) 14%, transparent); background: transparent; color: var(--encre); font: inherit; outline: none; }

.cache { display: none !important; }
.souffle { animation: souffle 2.4s ease-in-out infinite; }
@keyframes souffle { 50% { opacity: .55; } }
