/* Вистерия Лейн — адвент. Палитра — её palette-day.css */
:root {
  --cream: #f5ebdd; --paper: #fffaf3; --porcelain: #f6f0e6; --line: #e6dccb; --line2: #d9c9b0;
  --wine: #a91f36; --wine-d: #8c2635; --text: #3e2a31; --sub: #8a7470; --gold: #c49a5a;
  --sage: #8b9b78; --plum: #6b455d; --pink: #e8b7bf;
  --serif: "Cormorant Garamond", Georgia, serif; --sc: "Cormorant SC", "Cormorant Garamond", Georgia, serif;
  --body: "PT Serif", Georgia, serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--text); font: 16px/1.5 var(--body);
  background: var(--cream) radial-gradient(ellipse at 50% 0, #fbf4ea 0, var(--cream) 60%) no-repeat;
}
button { font: inherit; color: inherit; }
img { display: block; }
.center { text-align: center; }
.muted { color: var(--sub); }
[hidden] { display: none !important; }

/* ── заставка ── */
.splash { max-width: 760px; margin: 0 auto; padding: 22px 16px 6px; text-align: center; }
.splash .crest { width: 118px; margin: 0 auto; }
.splash .title { width: min(300px, 78%); margin: 4px auto 0; }
.orn { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--wine-d); margin: 6px auto 0; }
.orn::before, .orn::after { content: ""; height: 1px; width: 70px; background: currentColor; opacity: .7; }
.orn i { width: 6px; height: 6px; transform: rotate(45deg); background: currentColor; opacity: .85; }
.cast { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 22px auto 0; max-width: 700px; align-items: end; }
.cast .c { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.cast .c .pic { height: 62px; display: flex; align-items: flex-end; justify-content: center; }
.cast .c img { max-height: 58px; max-width: 100%; }
.cast .c .nm { margin-top: 6px; font: 600 clamp(7.5px, 2.15vw, 13px)/1.15 var(--sc); letter-spacing: .02em; text-transform: uppercase; word-break: keep-all; overflow-wrap: normal; }
.cast .c .orn { margin-top: 4px; }
.cast .c .orn::before, .cast .c .orn::after { width: 14px; }
.cast .c .orn i { width: 4px; height: 4px; }
.cast .me .ghost { width: 50px; height: 50px; border: 1.5px dashed var(--line2); border-radius: 50%; display: flex; align-items: center; justify-content: center; font: 600 22px var(--serif); color: var(--sub); }
.cast .me .nm { color: var(--plum); }
.cast .me.fresh .pic { animation: rise 1.4s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(.9); } to { opacity: 1; transform: none; } }
@media (min-width: 560px) {
  .splash .crest { width: 150px; }
  .cast .c .nm { letter-spacing: .06em; }
  .cast .c .pic { height: 92px; } .cast .c img { max-height: 86px; }
  .cast .c .nm { font-size: 13px; }
  .cast .me .ghost { width: 70px; height: 70px; }
  .cast .c .orn::before, .cast .c .orn::after { width: 22px; }
}

/* ── основное ── */
main, .foot { max-width: 620px; margin: 0 auto; padding: 0 16px; }
.lead { margin: 18px 0 0; text-align: center; font: italic 500 19px/1.4 var(--serif); color: var(--wine-d); }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-top: 16px; box-shadow: 0 2px 10px rgba(80, 54, 45, .06); }
.h { margin: 0; font: 600 22px/1.2 var(--serif); color: var(--wine-d); }
.kick { font: 600 12px var(--sc); letter-spacing: .12em; text-transform: uppercase; color: var(--sub); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 0 18px; border-radius: 22px; border: 1px solid var(--wine); background: var(--wine); color: #fff; font: 600 16px var(--serif); letter-spacing: .02em; cursor: pointer; text-decoration: none; }
.btn.ghost { background: transparent; color: var(--wine); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.wide { width: 100%; }
input.name { width: 100%; height: 46px; margin: 12px 0 10px; padding: 0 14px; border: 1px solid var(--line2); border-radius: 10px; background: #fff; font: 500 20px var(--serif); color: var(--text); outline: none; text-align: center; }
input.name:focus { border-color: var(--wine); }
.mailbox { display: flex; align-items: center; gap: 12px; }
.mailbox img { width: 46px; flex: none; }

/* коллекция значков */
.coll { display: flex; justify-content: center; gap: 8px; margin: 14px 0 0; flex-wrap: wrap; }
.coll img { height: 30px; width: auto; filter: grayscale(1) opacity(.22); transition: filter .4s; }
.coll img.on { filter: none; }
.coll-cap { text-align: center; font: italic 14px var(--serif); color: var(--sub); margin-top: 4px; }

/* двери */
.doors { display: grid; gap: 12px; margin: 18px 0 0; }
.door { position: relative; display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; text-align: left; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); cursor: pointer; }
.door .num { flex: none; width: 46px; height: 58px; border: 1.5px solid var(--wine); border-radius: 24px 24px 6px 6px; display: flex; align-items: center; justify-content: center; font: 600 24px var(--serif); color: var(--wine); }
.door .tx { flex: 1; min-width: 0; }
.door .tl { font: 600 20px/1.15 var(--serif); }
.door .dt { font-size: 13px; color: var(--sub); margin-top: 2px; }
.door .sy { height: 40px; width: auto; flex: none; }
.door.soon { cursor: default; background: transparent; border-style: dashed; }
.door.soon .num { border-color: var(--line2); color: var(--sub); }
.door.soon .sy { filter: grayscale(1) opacity(.25); }
.door.open { border-color: var(--wine); box-shadow: 0 0 0 3px rgba(169, 31, 54, .08); }
.door.done .num { background: var(--wine); color: #fff; }
.door.closed { opacity: .55; }
.chip { display: inline-block; margin-top: 4px; padding: 1px 8px; border-radius: 10px; font: 600 12px var(--body); background: var(--porcelain); color: var(--sub); }
.door.open .chip { background: var(--wine); color: #fff; }

.foot { padding-top: 26px; padding-bottom: 34px; text-align: center; font-size: 13px; color: var(--sub); }
.foot a, .linkbtn { color: var(--wine-d); background: none; border: none; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; font: inherit; }

/* ── окно двери ── */
.sheet { position: fixed; inset: 0; z-index: 50; overflow-y: auto; background: var(--cream); -webkit-overflow-scrolling: touch; }
.sheet-in { max-width: 620px; margin: 0 auto; padding: 14px 16px 60px; }
.back { border: none; background: none; color: var(--wine-d); font: 600 16px var(--serif); padding: 6px 0; cursor: pointer; }
.dhead { text-align: center; margin: 4px 0 6px; }
.dhead img { height: 56px; width: auto; margin: 0 auto 4px; }
.story p { margin: 12px 0 0; }
.story p:first-child { margin-top: 0; }

/* плашка голоса за кадром — как в плагине */
.ma-pl { display: block; margin: 16px 0 0; padding: 8px 12px; border-left: 3px solid var(--wine); border-radius: 0 10px 10px 0; background: rgba(169, 31, 54, .07); font-family: var(--serif); }
.ma-pl > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; }
.ma-pl > summary::-webkit-details-marker { display: none; }
.ma-pl > summary::after { content: "развернуть"; margin-left: auto; font: 12px var(--body); color: var(--sub); white-space: nowrap; }
.ma-pl[open] > summary::after { content: "свернуть"; }
.ma-pl .face { height: 46px; width: auto; flex: none; transition: height .2s; }
.ma-pl[open] .face { height: 64px; }
.ma-pl .t { font: 600 17px/1.2 var(--serif); }
.ma-pl .by { font: 12.5px var(--body); color: var(--sub); }
.ma-pl .x p { margin: 8px 0 0; font: italic 500 18px/1.45 var(--serif); }

/* записка */
.note { position: relative; margin: 18px 4px 0; padding: 22px 20px 20px; background: #fffdf8; border: 1px solid var(--line); box-shadow: 0 6px 18px rgba(80, 54, 45, .12); transform: rotate(-.6deg); font: italic 500 20px/1.45 var(--serif); }
.note p { margin: 0 0 10px; }
.note::before { content: ""; position: absolute; top: -9px; left: 50%; width: 80px; height: 18px; margin-left: -40px; background: rgba(232, 183, 191, .55); transform: rotate(2deg); }
.clues { margin: 10px 0 0; padding: 0; list-style: none; }
.clues li { position: relative; padding: 7px 0 7px 26px; border-bottom: 1px dashed var(--line); font-size: 15px; }
.clues li::before { content: "◆"; position: absolute; left: 4px; top: 7px; color: var(--wine); font-size: 11px; }
.sus { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 8px; margin-top: 12px; }
.su { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); cursor: pointer; text-align: center; }
.su img { height: 84px; width: auto; }
.su b { font: 600 17px/1.15 var(--serif); }
.su span { font-size: 12px; line-height: 1.35; color: var(--sub); }
.su.no { opacity: .4; }
.su.yes { border-color: var(--wine); box-shadow: 0 0 0 3px rgba(169, 31, 54, .12); }
.msg { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--porcelain); font: italic 500 17px/1.4 var(--serif); }
.msg.bad { background: #f7e1e3; color: var(--wine-d); }
.shake { animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

.solved { display: flex; gap: 12px; align-items: flex-end; margin-top: 16px; }
.solved img { height: 140px; width: auto; flex: none; }
.solved .x p { margin: 0 0 8px; font: italic 500 18px/1.45 var(--serif); }
.hint { margin-top: 14px; text-align: center; font: italic 500 16px var(--serif); color: var(--plum); }
.hint::before { content: "🍎 "; font-style: normal; }

/* тест */
.qn { margin-top: 16px; font: 600 20px/1.3 var(--serif); }
.opts { display: grid; gap: 8px; margin-top: 10px; }
.opt { padding: 12px 14px; border: 1px solid var(--line2); border-radius: 12px; background: var(--paper); text-align: left; cursor: pointer; font-size: 15.5px; line-height: 1.35; }
.opt:active, .opt.sel { border-color: var(--wine); background: #fbeef0; }
.prog { height: 3px; border-radius: 2px; background: var(--line); margin-top: 14px; overflow: hidden; }
.prog i { display: block; height: 100%; background: var(--wine); transition: width .3s; }
.result { text-align: center; }
.result img { height: 220px; width: auto; margin: 10px auto 0; }
.result .h { margin-top: 6px; }
.result p { margin: 8px 0 0; }

/* репутация */
.score { display: flex; align-items: center; gap: 14px; }
.ring { --p: 50; flex: none; width: 76px; height: 76px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: conic-gradient(var(--wine) calc(var(--p) * 1%), var(--line) 0); }
.ring b { width: 60px; height: 60px; border-radius: 50%; background: var(--paper); display: flex; align-items: center; justify-content: center; font: 600 24px var(--serif); color: var(--wine-d); }
.lines { margin-top: 12px; }
.ln { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-top: 1px dashed var(--line); }
.ln img { height: 40px; width: auto; flex: none; }
.ln .w { font: 600 13px var(--sc); letter-spacing: .06em; color: var(--sub); }
.ln .q { font: italic 500 17px/1.35 var(--serif); }
.ln .d { margin-left: auto; font: 600 13px var(--body); }
.ln .d.p { color: var(--sage); } .ln .d.m { color: var(--wine); }

/* мемори */
.mem { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.mc { position: relative; aspect-ratio: 3 / 4; border: none; padding: 0; background: none; cursor: pointer; perspective: 600px; }
.mc .in { position: absolute; inset: 0; transition: transform .35s; transform-style: preserve-3d; }
.mc.up .in, .mc.ok .in { transform: rotateY(180deg); }
.mc .f, .mc .b { position: absolute; inset: 0; border-radius: 10px; backface-visibility: hidden; -webkit-backface-visibility: hidden; display: flex; align-items: center; justify-content: center; }
.mc .b { background: var(--wine-d); border: 3px solid var(--paper); box-shadow: inset 0 0 0 1px var(--gold); }
.mc .b img { width: 60%; filter: brightness(0) invert(1) opacity(.35); }
.mc .f { transform: rotateY(180deg); background: var(--paper); border: 1px solid var(--line); overflow: hidden; align-items: flex-end; }
.mc .f img { height: 92%; width: auto; }
.mc.ok .f { border-color: var(--sage); }
.memcap { margin-top: 8px; text-align: center; font-size: 13px; color: var(--sub); }

/* дневник */
.diary { min-height: 100px; margin-top: 12px; padding: 4px 16px; background-position: 0 4px; background: #fffdf8; border: 1px solid var(--line); background-image: repeating-linear-gradient(transparent 0 31px, #eadfce 31px 32px); font: italic 500 19px/32px var(--serif); }
.diary .pc, .pool .pc { display: inline; padding: 2px 4px; margin: 0 1px; border-radius: 4px; cursor: pointer; }
.diary .pc { background: rgba(169, 31, 54, .07); }
.diary:empty::before { content: "Нажимай на кусочки по порядку…"; color: var(--sub); font-style: italic; }
.pool { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.pool .pc { display: block; padding: 8px 12px; border: 1px dashed var(--line2); border-radius: 8px; background: var(--paper); font: italic 500 17px/1.3 var(--serif); }

/* коробка */
.scene { position: relative; width: 100%; aspect-ratio: 4 / 3; margin-top: 12px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line2); background: #e9dcc6; touch-action: manipulation; cursor: crosshair; }
.scene .bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scene .decoy, .scene .hid { position: absolute; transform: translate(-50%, -50%); pointer-events: none; }
.scene .hid { opacity: .55; width: 9%; }
.scene .mark { position: absolute; transform: translate(-50%, -50%); border: 2px solid var(--wine); border-radius: 50%; pointer-events: none; animation: pop .4s ease both; }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -50%) scale(.6); } to { opacity: 1; transform: translate(-50%, -50%); } }
.scene .miss { position: absolute; transform: translate(-50%, -50%); width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(62, 42, 49, .35); pointer-events: none; animation: fade 0.7s forwards; }
@keyframes fade { to { opacity: 0; transform: translate(-50%, -50%) scale(1.8); } }
.found { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.found span { padding: 2px 9px; border-radius: 10px; font-size: 13px; background: var(--porcelain); color: var(--sub); }
.found span.on { background: var(--wine); color: #fff; }

/* голоса */
.vc { margin-top: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.vc .q { margin: 0; font: italic 500 17.5px/1.45 var(--serif); }
.vc .tag { margin-bottom: 6px; font: 600 12px var(--sc); letter-spacing: .1em; color: var(--sub); }
.hs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.hs button { padding: 4px 10px; border: 1px solid var(--line2); border-radius: 14px; background: #fff; font-size: 13.5px; cursor: pointer; }
.hs button.sel { background: var(--wine); border-color: var(--wine); color: #fff; }

/* знаки */
.icons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.ic { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); cursor: pointer; font: 600 15px/1.2 var(--serif); text-align: center; }
.ic .im { height: 64px; display: flex; align-items: center; justify-content: center; }
.ic img { max-height: 64px; max-width: 90%; }
.ic.sel { border-color: var(--wine); box-shadow: 0 0 0 3px rgba(169, 31, 54, .12); }
.ic .em { font-size: 40px; line-height: 1; }

/* финал */
.house { text-align: center; }
.house .no { font: 600 46px/1 var(--serif); color: var(--wine); }
.dl { display: grid; gap: 8px; margin-top: 12px; }
.gift { margin-top: 14px; padding: 12px 14px; border: 1.5px dashed var(--gold); border-radius: 12px; background: #fff8ea; font: 500 17px/1.4 var(--serif); text-align: center; }
.share img { width: 100%; border-radius: 10px; border: 1px solid var(--line); margin-top: 10px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 99; max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 12px; background: var(--text); color: #fff; font-size: 14px; box-shadow: 0 6px 20px rgba(0, 0, 0, .2); }

#acc, #vchk, #ichk, #chk { position: sticky; bottom: 12px; box-shadow: 0 6px 18px rgba(80, 54, 45, .25); }
#acc:disabled, #vchk:disabled, #ichk:disabled, #chk:disabled { position: static; box-shadow: none; }

/* первые три соседки на обложке */
.first { margin: 18px auto 0; max-width: 420px; }
.first .fr { display: flex; justify-content: center; gap: 18px; margin-top: 8px; }
.first .fc { display: flex; flex-direction: column; align-items: center; min-width: 0; max-width: 110px; }
.first .fi { height: 44px; display: flex; align-items: flex-end; justify-content: center; }
.first .fi img { max-height: 44px; max-width: 70px; }
.first .fi .em { font-size: 30px !important; }
.first b { margin-top: 4px; font: 600 15px/1.15 var(--serif); color: var(--plum); overflow-wrap: anywhere; }
.first span { font-size: 11.5px; color: var(--sub); }

/* чердак: на телефоне картинка шире экрана и листается вбок */
.scroller { overflow-x: auto; margin-top: 12px; border-radius: 12px; -webkit-overflow-scrolling: touch; }
.scene.photo { width: max(100%, 760px); margin-top: 0; aspect-ratio: auto; height: auto; border: none; }
.scene.photo .bg { position: relative; inset: auto; width: 100%; height: auto; display: block; }

/* конструктор портрета */
.av-wrap { display: flex; justify-content: center; margin-top: 12px; }
.av-prev { position: relative; width: 220px; aspect-ratio: 320 / 384; overflow: hidden; border-radius: 14px; background: radial-gradient(ellipse at 50% 35%, #fffaf3, #efe3d2); border: 6px solid #fff; box-shadow: 0 6px 18px rgba(80, 54, 45, .18); }
.av-prev img { position: absolute; left: -12.5%; top: -2.6%; width: 125%; height: auto; }
.av-tabs { display: flex; gap: 6px; overflow-x: auto; margin-top: 14px; padding-bottom: 2px; }
.av-tabs button { flex: none; padding: 6px 12px; border: 1px solid var(--line2); border-radius: 16px; background: #fff; font: 600 15px var(--serif); cursor: pointer; }
.av-tabs button.sel { background: var(--wine); border-color: var(--wine); color: #fff; }
.av-opts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; max-height: 320px; overflow-y: auto; }
.av-opts.chips { display: flex; flex-wrap: wrap; max-height: none; }
.av-o { padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); cursor: pointer; overflow: hidden; }
.av-o.sel { border-color: var(--wine); box-shadow: 0 0 0 2px rgba(169, 31, 54, .25); }
.av-th { display: block; position: relative; width: 100%; aspect-ratio: 1; overflow: hidden; }
.av-th img { position: absolute; left: -25%; top: -6%; width: 150%; height: auto; }
.av-th.hair img { left: -10%; top: -4%; width: 120%; }
.av-th.top img { left: -5%; top: -60%; width: 110%; }
.av-sw { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border: 1px solid var(--line2); border-radius: 16px; background: #fff; font-size: 14px; cursor: pointer; }
.av-sw i { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .15); }
.av-sw.sel { border-color: var(--wine); background: #fbeef0; }
.polaroid { width: 160px; margin: 10px auto 0; padding: 8px 8px 26px; background: #fff; box-shadow: 0 6px 16px rgba(80, 54, 45, .2); transform: rotate(-2deg); }
/* портрет в ряду героинь и у первых трёх */
.avs { position: relative; display: inline-block; }
.avs > img:first-child { height: 58px; width: auto; border-radius: 50% 50% 8px 8px; }
.avs .badge, .avs .em { position: absolute; right: -8px; bottom: -4px; height: 22px !important; width: auto; font-size: 16px !important; }
.first .avs > img:first-child { height: 52px; }
@media (min-width: 560px) { .avs > img:first-child { height: 86px; } }
