/* Majesty Flair game engine styling.
   Uses the existing ruby, crimson, hot-pink and midnight-purple system.
   No yellow, gold or brown. Every text pairing meets WCAG AA on its background. */

:root {
  --ink: #050305;
  --panel: #12080c;
  --ruby: #9e1033;
  --red: #ed174c;
  --rose: #ff3b64;
  --pink: #ff9bb2;
  --violet: #5a0b69;
  --magenta: #e62887;
  --purple: #100018;
  --cream: #fff8f8;
  --muted: #dac7cc;
}

* { box-sizing: border-box; }

html { background: var(--ink); }

body {
  margin: 0;
  background:
    radial-gradient(circle at 85% 8%, rgba(230, 40, 135, .2), transparent 24%),
    radial-gradient(circle at 10% 70%, rgba(90, 11, 105, .22), transparent 28%),
    linear-gradient(rgba(5, 3, 5, .94), rgba(5, 3, 5, .98)),
    url('/images/majesty-chair.webp') 90% 8% / min(42vw, 560px) auto no-repeat fixed,
    var(--ink);
  color: var(--cream);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.65;
}

.mf-wrap { width: min(1100px, calc(100% - 32px)); margin: 0 auto 80px; }

/* ---- top bar ---- */
.mf-bar {
  position: sticky; top: 0; z-index: 50;
  display: flex; justify-content: space-between; align-items: center; gap: 18px;
  padding: 14px 20px;
  background: linear-gradient(90deg, #570b1d, var(--ruby), var(--magenta), var(--violet));
  color: var(--cream);
  font-family: Arial, sans-serif;
  font-size: 12px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase;
}
.mf-bar a { color: inherit; }
.mf-bar nav { display: flex; gap: 14px; }

/* ---- headings ---- */
.mf-eyebrow {
  margin: 0; color: var(--pink);
  font-family: Arial, sans-serif;
  font-size: 11px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase;
}
h1, h2, h3 { font-family: Georgia, serif; font-weight: 400; line-height: 1.1; }
h1 { font-size: clamp(34px, 6vw, 60px); margin: .3em 0; }
h2 { font-size: clamp(26px, 4vw, 38px); margin: .3em 0; }
h3 { font-size: 20px; margin: .4em 0; }
.mf-lede { color: var(--muted); font-size: 18px; }
.mf-hook { max-width: 720px; margin: .5em 0; color: var(--cream); font-size: clamp(19px, 2.5vw, 25px); line-height: 1.42; }
.mf-payoff { max-width: 700px; margin: 18px 0 0; padding-left: 14px; border-left: 2px solid var(--rose); color: var(--muted); }
.mf-payoff strong { color: var(--pink); }
.mf-small { color: var(--muted); font-size: 14px; }
.mf-subhead { margin-top: 28px; }

/* ---- photographic entrances ---- */
.mf-page-hero, .mf-room-hero {
  position: relative; isolation: isolate; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(280px, .88fr);
  min-height: 520px; margin-top: 24px;
  border: 1px solid rgba(255, 155, 178, .34);
  background: linear-gradient(145deg, #210813, var(--purple));
  box-shadow: 0 38px 90px rgba(0, 0, 0, .46);
}
.mf-room-hero { min-height: 360px; grid-template-columns: minmax(0, 1.35fr) minmax(260px, .65fr); }
.mf-hero-copy { align-self: end; padding: clamp(30px, 6vw, 72px); }
.mf-hero-copy h1 { max-width: 780px; }
.mf-hero-copy .mf-lede { max-width: 690px; }
.mf-hero-image { position: relative; min-height: 100%; }
.mf-hero-image::before {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(90deg, #17020f 0, transparent 38%), linear-gradient(0deg, rgba(5, 3, 5, .62), transparent 52%);
}
.mf-hero-image img { width: 100%; height: 100%; min-height: 420px; object-fit: cover; object-position: 50% 22%; }
.mf-room-hero .mf-hero-image img { min-height: 360px; }
.mf-hero-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.mf-hero-badges span, .mf-cost {
  padding: 7px 10px; border: 1px solid rgba(255, 155, 178, .4);
  background: rgba(16, 0, 24, .72); color: var(--pink);
  font-family: Arial, sans-serif; font-size: 10px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase;
}
.mf-room-facts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.mf-room-facts span {
  padding: 6px 9px; border: 1px solid rgba(255, 155, 178, .28);
  background: rgba(16, 0, 24, .64); color: var(--pink);
  font-family: Arial, sans-serif; font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
}
.mf-room-facts .is-tribute { border-color: var(--magenta); background: rgba(230, 40, 135, .16); }
.mf-room-hero + [data-mf-game] { margin-top: 24px; }
.mf-hero-flourish {
  position: absolute; right: 2%; bottom: -20%; z-index: -1;
  color: rgba(255, 255, 255, .045); font-size: clamp(140px, 25vw, 310px); line-height: 1;
}

/* ---- consent gate ---- */
.mf-gate {
  margin-top: 28px; padding: clamp(22px, 4vw, 40px);
  border: 1px solid rgba(255, 155, 178, .32);
  background: linear-gradient(145deg, #210813, var(--purple));
}
.mf-rules { margin-top: 22px; padding: 18px 20px; border-left: 3px solid var(--rose); background: rgba(16, 0, 24, .6); }
.mf-rules ul { margin: .5em 0 0; padding-left: 1.2em; color: var(--muted); }
.mf-rules li { margin-bottom: .5em; }
.mf-virtual-note { margin-top: 18px; padding: 16px 18px; border: 1px solid var(--magenta); background: rgba(90, 11, 105, .25); }
.mf-virtual-note strong { color: var(--pink); }
.mf-virtual-note p { margin: .4em 0 0; color: var(--muted); }

.mf-filters { margin-top: 24px; }
.mf-filter {
  display: flex; gap: 14px; align-items: flex-start;
  margin-top: 10px; padding: 14px 16px; min-height: 44px;
  border: 1px solid rgba(255, 155, 178, .22);
  background: rgba(16, 0, 24, .55);
  cursor: pointer;
}
.mf-filter:hover, .mf-filter:focus-within { border-color: var(--rose); background: rgba(87, 11, 29, .4); }
.mf-check { width: 22px; height: 22px; margin-top: 3px; accent-color: var(--red); flex: none; }
.mf-filter-body { display: flex; flex-direction: column; gap: 3px; }
.mf-filter-body small { color: var(--muted); font-size: 13px; }

/* ---- game shell ---- */
.mf-game { margin-top: 24px; }
.mf-head {
  display: flex; flex-wrap: wrap; gap: 18px; justify-content: space-between; align-items: flex-end;
  padding-bottom: 18px; border-bottom: 1px solid rgba(255, 155, 178, .22);
}
.mf-head h2 { margin: .2em 0 0; }

.mf-stats { display: flex; flex-wrap: wrap; gap: 18px; }
.mf-stat { display: flex; flex-direction: column; align-items: flex-start; }
.mf-stat-v { color: var(--pink); font-family: Georgia, serif; font-size: 26px; line-height: 1; }
.mf-stat-l { color: var(--muted); font-family: Arial, sans-serif; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; }

.mf-live {
  margin: 10px 0 0; min-height: 1.4em;
  color: var(--pink); font-family: Arial, sans-serif; font-size: 13px;
}

.mf-body { margin-top: 8px; }

/* ---- cards ---- */
.mf-card {
  padding: clamp(20px, 3.5vw, 32px);
  border: 1px solid rgba(255, 155, 178, .22);
  background: linear-gradient(145deg, #0d0015, #140609);
}
.mf-card + .mf-card { margin-top: 14px; }
.mf-card-task { min-height: 190px; display: flex; flex-direction: column; justify-content: center; }
.mf-card-story .mf-task { font-size: 18px; }
.mf-card-empty { border-color: var(--rose); }
.mf-prompt { color: var(--muted); }
.mf-task { margin: 0; font-size: 19px; line-height: 1.7; }
.mf-cost { align-self: flex-start; margin: 0 0 14px; }
.mf-verdict { margin-top: 14px; color: var(--pink); font-style: italic; }
.mf-mini { padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; opacity: .55; }
.mf-mini.is-got { opacity: 1; border-color: var(--rose); }
.mf-mini small { color: var(--muted); font-size: 13px; }

.mf-in { animation: mfIn .38s cubic-bezier(.2, .7, .3, 1) both; }
@keyframes mfIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---- content tags ---- */
.mf-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.mf-tag {
  padding: 4px 9px;
  border: 1px solid var(--rose); color: var(--pink);
  font-family: Arial, sans-serif; font-size: 10px; font-weight: 800;
  letter-spacing: .1em; text-transform: uppercase;
}

/* ---- buttons ---- */
.mf-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
.mf-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 12px 24px;
  border: 1px solid var(--rose); background: rgba(87, 11, 29, .35);
  color: var(--pink);
  font-family: Arial, sans-serif; font-size: 13px; font-weight: 800;
  letter-spacing: .1em; text-transform: uppercase; text-decoration: none;
  cursor: pointer;
  transition: background .25s ease, color .25s ease, transform .25s ease;
}
.mf-btn:hover { background: var(--ruby); color: var(--cream); }
.mf-btn-primary {
  border-color: transparent;
  background: linear-gradient(110deg, var(--ruby), var(--red), var(--magenta));
  color: var(--cream);
}
.mf-btn-primary:hover { transform: translateY(-2px); }
.mf-btn-quiet { background: transparent; }
.mf-btn:focus-visible, .mf-choice:focus-visible, .mf-filter:focus-within { outline: 3px solid var(--pink); outline-offset: 2px; }

/* ---- choices ---- */
.mf-choices { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.mf-choice {
  display: flex; gap: 14px; align-items: flex-start; width: 100%;
  min-height: 48px; padding: 16px 18px; text-align: left;
  border: 1px solid rgba(255, 155, 178, .3);
  background: rgba(16, 0, 24, .62);
  color: var(--cream);
  font-family: Georgia, serif; font-size: 16px; line-height: 1.55;
  cursor: pointer;
  transition: border-color .25s ease, background .25s ease, transform .25s ease;
}
.mf-choice:hover:not(:disabled) { border-color: var(--rose); background: rgba(87, 11, 29, .45); transform: translateX(3px); }
.mf-choice:disabled { cursor: default; opacity: .75; }
.mf-choice.is-right { border-color: #35c07a; background: rgba(20, 70, 45, .55); }
.mf-choice.is-wrong { border-color: var(--red); background: rgba(120, 12, 34, .5); }
.mf-choice-n {
  flex: none; width: 28px; height: 28px;
  display: grid; place-items: center;
  border: 1px solid var(--rose); color: var(--pink);
  font-family: Arial, sans-serif; font-size: 12px; font-weight: 800;
}
.mf-xp { color: var(--pink); font-family: Arial, sans-serif; font-size: 12px; font-weight: 800; }

.mf-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; margin-top: 14px; }
.mf-grid .mf-choice { flex-direction: column; gap: 6px; }

.mf-feedback {
  margin-top: 14px; padding: 16px 18px;
  border-left: 3px solid var(--rose); background: rgba(16, 0, 24, .7);
  color: var(--muted);
}
.mf-feedback strong { color: var(--cream); }
.mf-feedback p { margin: .5em 0 0; }

/* ---- fictional tribute ledger ---- */
.mf-ledger {
  position: relative; overflow: hidden; margin-top: 18px; padding: clamp(20px, 3.5vw, 32px);
  border: 1px solid var(--magenta);
  background: radial-gradient(circle at 92% 0, rgba(230, 40, 135, .2), transparent 35%), linear-gradient(145deg, #190017, #170609);
}
.mf-ledger::after { content: "MARKS"; position: absolute; right: -8px; bottom: -35px; color: rgba(255, 255, 255, .035); font: 86px Georgia, serif; pointer-events: none; }
.mf-ledger-head { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(200px, .75fr) minmax(240px, 1.25fr); gap: 24px; align-items: end; }
.mf-ledger-head h3 { margin: .25em 0 0; color: var(--pink); font-size: clamp(28px, 4vw, 42px); }
.mf-ledger-rank { margin: 4px 0 0; color: var(--rose); font-family: Arial, sans-serif; font-size: 11px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.mf-ledger-note { margin: 0; color: var(--muted); font-size: 14px; }
.mf-ledger-detail { position: relative; z-index: 1; margin-top: 14px; padding: 14px 16px; border-left: 3px solid var(--rose); background: rgba(5, 3, 5, .48); color: var(--muted); }
.mf-ledger-detail p { margin: 0; }

.mf-modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(5, 3, 5, .88); backdrop-filter: blur(8px); }
.mf-modal-card { width: min(620px, 100%); max-height: min(760px, calc(100vh - 40px)); overflow: auto; padding: clamp(24px, 5vw, 44px); border: 1px solid var(--rose); background: linear-gradient(145deg, #210813, var(--purple)); box-shadow: 0 30px 90px rgba(0, 0, 0, .72); }
.mf-modal-card h3 { color: var(--pink); font-size: clamp(26px, 4vw, 38px); }

/* ---- progress ---- */
.mf-progress { display: block; width: 100%; height: 8px; margin: 14px 0; border: 0; background: rgba(255, 155, 178, .16); overflow: hidden; }
.mf-progress::-webkit-progress-bar { background: rgba(255, 155, 178, .16); }
.mf-progress::-webkit-progress-value { background: linear-gradient(90deg, var(--ruby), var(--magenta)); }
.mf-progress::-moz-progress-bar { background: linear-gradient(90deg, var(--ruby), var(--magenta)); }

/* ---- footer ---- */
.mf-foot {
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between;
  margin-top: 26px; padding-top: 20px;
  border-top: 1px solid rgba(255, 155, 178, .22);
}

/* ---- index ---- */
.mf-rooms { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; margin-top: 24px; }
.mf-room {
  position: relative; overflow: hidden; display: flex; flex-direction: column; min-height: 250px; padding: 28px 24px;
  border: 1px solid rgba(255, 155, 178, .24);
  background: linear-gradient(160deg, #210813, var(--purple));
  color: var(--cream); text-decoration: none;
  transition: border-color .3s ease, transform .3s ease, box-shadow .3s ease;
}
.mf-room::after { content: "↗"; position: absolute; right: 20px; bottom: 18px; color: var(--pink); font: 28px Georgia, serif; }
.mf-room::before { content: attr(data-number); position: absolute; right: -4px; top: -32px; color: rgba(255, 255, 255, .045); font: 110px Georgia, serif; }
.mf-room:hover { border-color: var(--rose); transform: translateY(-4px); box-shadow: 0 16px 40px rgba(237, 23, 76, .28); }
.mf-room h3 { margin: .2em 0 .3em; color: var(--pink); }
.mf-room p { margin: 0; color: var(--muted); font-size: 15px; }
.mf-room .mf-room-hook { color: var(--cream); font-size: 17px; line-height: 1.5; }
.mf-room .mf-room-payoff { margin-top: 12px; color: var(--muted); font-size: 13px; }
.mf-room .mf-room-facts { margin-top: auto; padding-top: 18px; }
.mf-room-meta { margin-top: 12px; color: var(--pink); font-family: Arial, sans-serif; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
.mf-hold { opacity: .6; }
.mf-hold::after { content: "Locked"; font: 10px Arial, sans-serif; letter-spacing: .12em; text-transform: uppercase; }
.mf-hold .mf-room-meta { color: var(--muted); }

/* ---- picture puzzle ---- */
.mf-puzzle-layout { display: grid; grid-template-columns: minmax(280px, 620px) minmax(200px, 1fr); gap: 22px; align-items: start; }
.mf-puzzle { display: grid; grid-template-columns: repeat(3, 1fr); aspect-ratio: 1; gap: 4px; padding: 4px; border: 1px solid var(--rose); background: #210813; box-shadow: 0 28px 70px rgba(230, 40, 135, .2); }
.mf-tile { min-width: 0; min-height: 0; border: 0; background-image: url('/images/majesty-play.webp'); background-size: 300% 300%; cursor: pointer; }
.mf-tile:disabled { cursor: default; filter: brightness(.58) saturate(.76); }
.mf-tile:not(:disabled):hover, .mf-tile:not(:disabled):focus-visible { outline: 3px solid var(--pink); outline-offset: -3px; filter: brightness(1.15); }
.mf-tile-empty { background: radial-gradient(circle, rgba(230, 40, 135, .24), transparent 68%); }
.mf-tile-0 { background-position: 0 0; }.mf-tile-1 { background-position: 50% 0; }.mf-tile-2 { background-position: 100% 0; }
.mf-tile-3 { background-position: 0 50%; }.mf-tile-4 { background-position: 50% 50%; }.mf-tile-5 { background-position: 100% 50%; }
.mf-tile-6 { background-position: 0 100%; }.mf-tile-7 { background-position: 50% 100%; }
.mf-puzzle-reference { padding: 20px; border: 1px solid rgba(255, 155, 178, .24); background: linear-gradient(145deg, #210813, var(--purple)); }
.mf-puzzle-reference img { display: block; width: 100%; max-height: 360px; margin-top: 10px; object-fit: cover; object-position: 50% 28%; }
.mf-puzzle-win { margin-top: 18px; border-left-color: var(--magenta); }

@media (max-width: 640px) {
  .mf-bar { flex-direction: column; align-items: flex-start; }
  .mf-head { align-items: flex-start; }
  .mf-task { font-size: 17px; }
  .mf-page-hero, .mf-room-hero { grid-template-columns: 1fr; min-height: 0; }
  .mf-hero-copy { order: 2; padding: 28px 22px; }
  .mf-hero-image { order: 1; min-height: 300px; }
  .mf-hero-image img, .mf-room-hero .mf-hero-image img { min-height: 300px; max-height: 420px; }
  .mf-puzzle-layout { grid-template-columns: 1fr; }
  .mf-ledger-head { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
