/* /mesel: az Ötletíró közös részei (a kinézetek, mesel-a/b/c.css, csak a vázat és a hangulatot adják). Az app.css változóira épül. */
.ms-root { position: relative; }
.b-ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }

/* az írás */
#t-title { font: 700 clamp(1.4rem, 3.4vw, 1.9rem)/1.2 var(--serif); padding: 8px 2px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: inherit; }
#t-title:focus { border-bottom-color: var(--gold); outline: none; }
#t-title::placeholder { color: var(--mute); opacity: .7; font-weight: 500; }
#t-body { resize: none; overflow: hidden; min-height: 11em; padding: 10px 2px; border: 0; border-radius: 0; background: transparent; color: inherit;
  font: 1.12rem/1.65 var(--serif); }
#t-body:focus { outline: none; }
#t-body::placeholder { color: var(--mute); opacity: .75; }
#t-body.ms-fade::placeholder { animation: ms-ph .5s; }
@keyframes ms-ph { from { opacity: 0; transform: translateY(4px); } }
.ms-under { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 30px; }
.ms-dice { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px 5px 8px; border-radius: 999px; border: 1px dashed var(--line); background: transparent; color: var(--mute);
  font: 700 .82rem var(--sans); cursor: pointer; }
.ms-dice:hover { color: var(--ink); border-color: var(--gold); }
.ms-dice:hover .b-ic { animation: ms-roll .5s; }
@keyframes ms-roll { to { transform: rotate(180deg); } }
.ms-dice .b-ic { width: 17px; height: 17px; }

/* mentés állapota */
.ms-save { display: inline-flex; align-items: center; gap: 8px; padding: 4px 11px 4px 9px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-size: .82rem; color: var(--mute); }
.ms-save i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex: none; transition: background .2s; }
.ms-save[data-state="saving"] i { background: var(--gold); animation: ms-pulse .8s infinite alternate; }
.ms-save[data-state="dirty"] i { background: var(--mute); }
.ms-save[data-state="error"] { color: #ffd0d5; border-color: rgba(255, 107, 122, .4); }
.ms-save[data-state="error"] i { background: var(--red); }
.ms-save small { color: var(--mute); opacity: .8; }
@keyframes ms-pulse { to { opacity: .3; } }

/* állapot-csipek */
.ms-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ms-chips:empty { display: none; }
.ms-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px 4px 9px; border-radius: 999px; font: 800 .78rem var(--sans); text-decoration: none; letter-spacing: .02em; }
.ms-chip .b-ic { width: 16px; height: 16px; }
.ms-chip.teal { background: rgba(63, 193, 208, .18); color: #9fe8f0; }
.ms-chip.gold { background: rgba(245, 196, 81, .18); color: var(--gold); }

/* lista */
.ms-listbox { display: grid; gap: 10px; align-content: start; }
.ms-list-top { display: grid; gap: 8px; }
.ms-newbtn { width: 100%; min-height: 44px; }
.ms-search input { padding: 9px 12px; border-radius: 12px; font-size: .95rem; }
.ms-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ms-item { display: grid; gap: 3px; padding: 10px 12px; border-radius: 14px; text-decoration: none; color: var(--ink2); border: 1px solid transparent; background: var(--card); transition: background .12s, border-color .12s; }
.ms-item:hover { background: var(--card2); }
.ms-item.on { border-color: var(--gold); background: rgba(245, 196, 81, .09); color: var(--ink); }
.ms-item b { font: 700 .98rem/1.3 var(--serif); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-ex { font-size: .82rem; color: var(--mute); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.35; }
.ms-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: .74rem; color: var(--mute); margin-top: 2px; }
.ms-meta i { font-style: normal; }
.ms-meta .st { padding: 1px 7px; border-radius: 999px; font-weight: 800; }
.ms-meta .st.teal { background: rgba(63, 193, 208, .18); color: #9fe8f0; }
.ms-meta .st.gold { background: rgba(245, 196, 81, .18); color: var(--gold); }
.ms-meta .badge { height: 18px; min-width: 18px; font-size: .68rem; }
.ms-none { margin: 4px 2px; }
.ms-bin { font-size: .86rem; color: var(--mute); }
.ms-bin summary { cursor: pointer; padding: 6px 4px; }
.ms-bin ul { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 6px; }
.ms-bin li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; padding: 6px 8px; border-radius: 10px; background: var(--card); }
.ms-bin li span { flex: 1 1 100%; color: var(--ink2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-bin .link { font-size: .8rem; }
.ms-bin .link.red { color: var(--red); }
.ms-localnote { margin: 4px 2px 0; }

/* változatok */
.ms-versions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ms-vbtn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink2); font: 700 .86rem var(--sans); cursor: pointer; transition: border-color .12s, background .12s; }
.ms-vbtn:hover { border-color: var(--gold); color: var(--ink); }
.ms-vnew { border-style: dashed; }
.ms-v b { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--gold); color: var(--btn); font: 800 .78rem var(--sans); }
.ms-v span { max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-vhint { flex: 1 1 100%; }

/* fájlok: csempék */
.ms-tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.ms-tile { position: relative; display: grid; gap: 4px; animation: pop-in .25s; }
.ms-tbtn { position: relative; display: block; width: 100%; aspect-ratio: 1; padding: 0; border: 0; border-radius: 14px; overflow: hidden; background: rgba(10, 6, 30, .35); cursor: pointer; color: var(--ink); }
.ms-tbtn img, .ms-tbtn video { display: block; width: 100%; height: 100%; object-fit: cover; }
.ms-tbtn:hover img, .ms-tbtn:hover video { transform: scale(1.04); }
.ms-tbtn img, .ms-tbtn video { transition: transform .2s; }
.ms-play { position: absolute; inset: 0; display: grid; place-items: center; font-style: normal; font-size: 1.6rem; color: #fff; text-shadow: 0 1px 6px rgba(0, 0, 0, .7); }
.ms-ext { display: grid; place-items: center; width: 100%; height: 100%; font: 800 .8rem var(--sans); letter-spacing: .05em; color: var(--teal); }
.ms-ext.audio { color: var(--gold); font-size: 1.8rem; }
.ms-tname { font-size: .72rem; color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
.ms-tdel { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(10, 6, 30, .7); color: #fff; cursor: pointer; display: grid; place-items: center; opacity: 0; transition: opacity .12s; }
.ms-tdel .b-ic { width: 14px; height: 14px; stroke-width: 2.6; }
.ms-tile:hover .ms-tdel, .ms-tile:focus-within .ms-tdel, .ms-basecard:hover .ms-tdel, .ms-basecard:focus-within .ms-tdel { opacity: 1; }
@media (pointer: coarse) { .ms-tdel { opacity: 1; } }
.ms-tdel:hover { background: var(--red); }
.ms-tile.add .ms-tbtn { display: grid; place-items: center; align-content: center; gap: 4px; border: 2px dashed rgba(255, 255, 255, .25); background: transparent; color: var(--mute); }
.ms-tile.add .ms-tbtn:hover, .ms-root.ms-over .ms-tile.add .ms-tbtn { border-color: var(--gold); color: var(--ink); background: rgba(245, 196, 81, .08); }
.ms-tile.add .ms-tbtn > span { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--gold); color: var(--btn); }
.ms-tile.add small { font-size: .7rem; padding: 0 6px; text-align: center; }
.ms-tile.up .ms-tbtn { background: linear-gradient(90deg, rgba(245, 196, 81, .25) var(--p, 0%), rgba(10, 6, 30, .35) var(--p, 0%)); }
.ms-prog { position: absolute; left: 10%; right: 10%; bottom: 10px; height: 5px; border-radius: 99px; background: rgba(255, 255, 255, .15); overflow: hidden; }
.ms-prog::after { content: ""; position: absolute; inset: 0; width: var(--p, 0%); background: var(--gold); }
.ms-fhint { margin: 8px 2px 0; }
#ms-ferr:empty { display: none; }
#ms-ferr { margin: 6px 0 0; }
.ms-root.ms-over::after { content: "Ejtsd ide, és az ötlethez kerül"; position: fixed; inset: 10px; z-index: 60; display: grid; place-items: center; border: 3px dashed var(--gold); border-radius: 24px; background: rgba(26, 18, 56, .8); color: var(--gold); font: 800 1.3rem var(--serif); pointer-events: none; }
.ms-big { display: block; max-width: 100%; max-height: 70vh; margin: 0 auto; border-radius: 12px; background: #000; }

/* kezdőjáték */
.ms-basecard { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); }
.ms-basecard img, .ms-bph { width: 72px; height: 48px; border-radius: 10px; object-fit: cover; flex: none; }
.ms-bph { display: grid; place-items: center; background: linear-gradient(135deg, #5a3fb0, #2a1f55); font: 700 1.3rem var(--serif); }
.ms-bt { display: grid; gap: 1px; min-width: 0; }
.ms-bt small { color: var(--mute); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 800; }
.ms-bt b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-basecard .ms-tdel { top: 50%; transform: translateY(-50%); right: 10px; }
.ms-basepick { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 16px; border: 1px dashed var(--line); background: transparent; color: var(--ink2); text-align: left; cursor: pointer; }
.ms-basepick:hover { border-color: var(--gold); color: var(--ink); }
.ms-basepick .b-ic { width: 26px; height: 26px; color: var(--gold); }
.ms-basepick span { display: grid; gap: 1px; }
.ms-basepick small { color: var(--mute); font-size: .8rem; }
.ms-gtiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin: 6px 0 16px; }
.ms-gtile { display: grid; gap: 6px; padding: 0; border: 2px solid transparent; border-radius: 14px; background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.ms-gtile img, .ms-gtile .ms-bph { width: 100%; height: auto; aspect-ratio: 16 / 10; border-radius: 12px; object-fit: cover; }
.ms-gtile b { font: 700 .9rem var(--serif); padding: 0 4px; }
.ms-gtile small { color: var(--mute); font-size: .74rem; padding: 0 4px; margin-top: -4px; }
.ms-gtile:hover img, .ms-gtile:hover .ms-bph { outline: 2px solid var(--gold); }

/* beszélgetés */
.ms-threadbox { display: grid; gap: 10px; }
.ms-msgs { max-height: 380px; overflow-y: auto; }
.ms-tempty { color: var(--mute); font-size: .92rem; margin: 0; }
.ms-tempty b { color: var(--ink2); }
.ms-compose { display: flex; gap: 8px; align-items: flex-end; }
.ms-compose textarea { flex: 1; min-height: 46px; max-height: 160px; resize: vertical; font: 1rem var(--sans); padding: 10px 12px; border-radius: 14px; }
.ms-tlogin { margin: 0; color: var(--mute); }

/* segítség */
.ms-helpbox { display: grid; gap: 4px; }
.ms-faq { border-radius: 12px; background: var(--card); }
.ms-faq summary { cursor: pointer; padding: 9px 12px; font-weight: 700; font-size: .92rem; list-style: none; display: flex; justify-content: space-between; gap: 8px; }
.ms-faq summary::-webkit-details-marker { display: none; }
.ms-faq summary::after { content: "+"; color: var(--gold); font-weight: 800; }
.ms-faq[open] summary::after { content: "–"; }
.ms-faq > div { padding: 0 12px 12px; font-size: .9rem; color: var(--ink2); }

/* a két út és az eszközök */
.ms-actionsbox { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ms-go { min-height: 58px; padding: 8px 14px; justify-content: flex-start; text-align: left; border-radius: 18px; }
.ms-go span { display: grid; gap: 1px; line-height: 1.2; }
.ms-go small { font-weight: 600; font-size: .74rem; opacity: .8; }
.ms-go .b-ic { width: 24px; height: 24px; }
.ms-go.idea { background: linear-gradient(180deg, #52d2e0, var(--teal)); color: #06313a; box-shadow: 0 8px 22px rgba(63, 193, 208, .25); }
.ms-go.idea:hover { box-shadow: 0 12px 28px rgba(63, 193, 208, .38); }
#ms-tools { min-width: 0; }
.ms-toolsbox { display: flex; flex-wrap: wrap; gap: 6px; }
.ms-tool { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink2); font: 700 .84rem var(--sans); cursor: pointer; }
.ms-tool:hover { border-color: var(--gold); color: var(--ink); }
.ms-tool:disabled { opacity: .4; cursor: not-allowed; }
.ms-tool.danger:hover { border-color: var(--red); color: var(--red); }
.ms-tool .b-ic { width: 18px; height: 18px; }

/* a kinézet-váltó: a gazdának, amíg választ */
.ms-look { position: fixed; left: 14px; bottom: calc(var(--tabs) + 14px); z-index: 50; display: inline-flex; align-items: center; gap: 3px; padding: 4px 4px 4px 10px; border-radius: 999px;
  background: rgba(22, 14, 50, .92); border: 1px solid var(--line); box-shadow: 0 10px 26px rgba(0, 0, 0, .4); backdrop-filter: blur(8px); }
.ms-look span { font: 800 .68rem var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--mute); margin-right: 4px; }
.ms-look button { width: 32px; height: 32px; border-radius: 50%; border: 0; background: transparent; color: var(--ink2); font: 800 .85rem var(--sans); cursor: pointer; }
.ms-look button[aria-pressed="true"] { background: var(--gold); color: var(--btn); }
body:has(.tp-btn) .ms-look { bottom: calc(var(--tabs) + 14px); left: 14px; }

/* a lap: középen asztalon, alulról telefonon */
.ms-lock, .ms-lock body { overflow: hidden; }
.ms-sheet { position: fixed; left: 0; right: 0; top: 0; height: 100%; z-index: 85; display: grid; place-items: center; padding: 18px; background: rgba(8, 4, 22, .72); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fade .2s; }
.ms-panel { position: relative; width: min(100%, 600px); max-height: 100%; overflow: auto; overscroll-behavior: contain; background: var(--night2); border: 1px solid var(--line); border-radius: 24px; padding: 24px; box-shadow: 0 30px 80px rgba(0, 0, 0, .55); animation: pop-in .25s; }
.ms-panel h2 { padding-right: 36px; margin-bottom: 10px; }
.ms-x { position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--card2); color: var(--ink); font: 1.5rem/1 var(--sans); cursor: pointer; }
.ms-acts { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.ms-acts .btn { flex: 1 1 auto; }
.ms-pb .err:empty { display: none; }
.ms-pub { margin: 14px 0 0; }
.ms-pub textarea { min-height: 9em; font-family: var(--serif); }
.ms-info, .ms-warn { padding: 10px 14px; border-radius: 14px; background: rgba(63, 193, 208, .12); color: var(--ink2); }
.ms-warn { background: rgba(245, 196, 81, .12); }
.ms-or { margin: 16px 0 0; text-align: center; }
.ms-plans { border: 0; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.ms-plan { position: relative; display: grid; gap: 4px; padding: 14px 16px 14px 48px; border-radius: 18px; border: 2px solid var(--line); background: var(--card); cursor: pointer; transition: border-color .12s, background .12s; }
.ms-plan input { position: absolute; left: 16px; top: 17px; width: 20px; height: 20px; margin: 0; accent-color: var(--gold); }
.ms-plan.on { border-color: var(--gold); background: rgba(245, 196, 81, .1); }
.ms-plan:focus-within { outline: 3px solid var(--gold); outline-offset: 2px; }
.pl-h { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.pl-h b { font-size: 1.05rem; }
.pl-c { text-align: right; white-space: nowrap; }
.pl-c b { color: var(--gold); }
.pl-c small { display: block; color: var(--mute); font-size: .78rem; }
.pl-w { font-size: .88rem; color: var(--ink2); }
.pl-inc { display: none; margin-top: 6px; }
.ms-plan.on .pl-inc { display: grid; gap: 3px; }
.pl-inc span::before { content: "✓ "; color: var(--green); font-weight: 800; }
.pl-pub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.pl-pub button { min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--ink2); font: 700 .86rem var(--sans); cursor: pointer; }
.pl-pub button[aria-pressed="true"] { background: var(--gold); color: var(--btn); border-color: var(--gold); }
.pl-pub small { color: var(--mute); font-size: .78rem; }
.ms-sum { margin: 14px 0 0; }
.ms-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin: 14px 0 16px; border-radius: 999px; background: var(--card2); }
.ms-tabs button { min-height: 40px; border: 0; border-radius: 999px; background: transparent; color: var(--ink2); font: 700 .92rem var(--sans); cursor: pointer; }
.ms-tabs button[aria-pressed="true"] { background: var(--gold); color: var(--btn); }
.ms-auth .check { margin: 0 0 14px; }
.ms-auth .btn { margin-top: 6px; }
.ms-bar { margin: 10px 0; }
.ms-bar i { transition: width .25s; }
.ms-spin { display: grid; place-items: center; padding: 18px 0 6px; }
.ms-spin i { width: 42px; height: 42px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--gold); animation: ms-spinr .8s linear infinite; }
@keyframes ms-spinr { to { transform: rotate(360deg); } }
.ms-done { text-align: center; padding: 10px 0 4px; }
.ms-done h2 { padding: 0; }
.ms-ok { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--green); color: var(--night); font: 800 2rem var(--sans); margin-bottom: 12px; animation: pop-in .35s cubic-bezier(.3, 1.6, .5, 1); }
.ms-undo { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ms-undo .link { color: #6b2fd6; }

/* a változat lapja */
.ms-vtabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--card2); margin: 4px 0 12px; }
.ms-vtabs button { min-height: 34px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; color: var(--ink2); font: 700 .86rem var(--sans); cursor: pointer; }
.ms-vtabs button[aria-pressed="true"] { background: var(--gold); color: var(--btn); }
.ms-vtabs button:disabled { opacity: .4; cursor: not-allowed; }
.ms-vtext { white-space: pre-wrap; overflow-wrap: anywhere; font: 1rem/1.55 var(--serif); max-height: 50vh; overflow: auto; padding: 14px 16px; border-radius: 14px; background: var(--card); }
.ms-vtext.paper { background: var(--paper); color: #2b2440; }
.ms-vtitle { display: block; font-size: 1.2rem; margin-bottom: 8px; }
.ms-vtext del { background: rgba(255, 107, 122, .25); text-decoration: line-through; text-decoration-color: rgba(255, 107, 122, .7); border-radius: 3px; }
.ms-vtext ins { background: rgba(127, 209, 160, .25); text-decoration: none; border-radius: 3px; }
.ms-cmp { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ms-cmp .kicker { margin-bottom: 4px; }
.ms-acts .btn.danger { box-shadow: none; }

@media (max-width: 640px) {
  .ms-sheet { place-items: end stretch; padding: 0; }
  .ms-panel { width: 100%; max-height: 92%; border-radius: 24px 24px 0 0; padding: 22px 18px calc(20px + env(safe-area-inset-bottom)); animation: ms-up .28s ease-out; }
  .ms-acts { flex-direction: column-reverse; }
  .ms-acts .btn { width: 100%; }
  .ms-cmp { grid-template-columns: 1fr; }
  .ms-actionsbox { grid-template-columns: 1fr; }
}
@keyframes ms-up { from { transform: translateY(40px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .ms-tile, .ms-panel, .ms-sheet, .ms-ok { animation: none; } }
