:root { --ink: #fffaf0; --shadow: 0 1px 14px rgba(10,16,30,.55), 0 0 2px rgba(10,16,30,.45); --serif: "Iowan Old Style","Palatino Linotype",Palatino,"Book Antiqua",Georgia,serif; --ar: "Amiri Quran","Amiri","Scheherazade New","Noto Naskh Arabic",serif; }
html, body { margin: 0; height: 100%; background: #14131f; overflow: hidden; }
body { font-family: var(--serif); color: var(--ink); -webkit-font-smoothing: antialiased; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.ui { position: fixed; pointer-events: none; text-shadow: var(--shadow); }
.hidden { display: none !important; }
#fade { inset: 0; background: #14131f; opacity: 1; transition: opacity 1.2s ease; z-index: 5; }
#hud { top: 0; left: 0; right: 0; padding: max(14px, env(safe-area-inset-top)) 18px 0; display: flex; justify-content: space-between; z-index: 6; }
.hudbtn { pointer-events: auto; font-size: clamp(11px, 1.05vw, 14px); letter-spacing: .32em; text-transform: uppercase; opacity: .85; text-shadow: var(--shadow); padding: 6px 4px; }
.hudbtn:hover { opacity: 1; }
#hud-num { letter-spacing: .2em; margin-right: .5em; }
#story { left: 0; right: 0; margin: 0 auto; bottom: 9%; width: fit-content; max-width: min(860px, 88vw); text-align: center; font-style: italic; font-size: clamp(17px, 2.1vw, 29px); line-height: 1.4; opacity: 0; transition: opacity 1.3s ease; text-wrap: balance; padding: .5em 1.4em; border-radius: 1.4em; background: radial-gradient(closest-side, rgba(10,9,16,.34), rgba(10,9,16,.16) 55%, rgba(10,9,16,0)); z-index: 4; }
#story .ar { font-family: var(--ar); font-style: normal; font-size: 1.35em; display: block; direction: rtl; line-height: 1.9; }
#story .tr { font-size: .8em; opacity: .9; display: block; }
#hint { left: 0; right: 0; margin: 0 auto; width: fit-content; max-width: 92vw; bottom: max(3%, env(safe-area-inset-bottom)); font-size: clamp(11px, 1vw, 14px); letter-spacing: .28em; text-transform: uppercase; opacity: 0; transition: opacity 1s ease; text-align: center; z-index: 4; }
#card { inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; opacity: 0; transition: opacity 1.1s ease; padding-bottom: 22vh; box-sizing: border-box; z-index: 6; }
#card .num { font-size: clamp(12px, 1.1vw, 16px); letter-spacing: .5em; opacity: .85; }
#card .name { font-size: clamp(30px, 5.4vw, 78px); letter-spacing: .14em; margin-top: .25em; text-transform: uppercase; }
#card .sub { font-style: italic; font-size: clamp(14px, 1.6vw, 22px); margin-top: .5em; opacity: .92; }
.screen { position: fixed; inset: 0; z-index: 8; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; text-shadow: var(--shadow); transition: opacity .9s ease; }
#title { padding-bottom: 18vh; box-sizing: border-box; }
#title h1 { font-weight: 400; font-size: clamp(44px, 10vw, 136px); letter-spacing: .2em; margin: 0 0 0 .2em; text-transform: uppercase; }
#title .tag { font-style: italic; font-size: clamp(15px, 2vw, 26px); margin: .5em 0 0; opacity: .95; }
.rule { width: min(260px, 40vw); height: 1px; background: rgba(255,255,255,.7); margin-top: 1.4em; }
.go { margin-top: 2.6em; font-size: clamp(12px, 1.15vw, 16px); letter-spacing: .32em; text-transform: uppercase; animation: pulse 2.6s ease-in-out infinite; text-shadow: var(--shadow); padding: 10px; }
@keyframes pulse { 50% { opacity: .6; } }
.row { display: flex; gap: 1.6em; justify-content: center; flex-wrap: wrap; margin-top: 1.8em; }
.link { font-size: clamp(12px, 1vw, 14px); letter-spacing: .22em; text-transform: uppercase; opacity: .85; text-shadow: var(--shadow); padding: 8px 2px; border-bottom: 1px solid rgba(255,255,255,.35); }
.link:hover { opacity: 1; }
.pill { padding: .7em 2.2em; border-radius: 99px; background: rgba(255,250,240,.92); color: #2a2238; letter-spacing: .2em; text-transform: uppercase; font-size: clamp(12px, 1.05vw, 15px); text-shadow: none; box-shadow: 0 6px 24px rgba(0,0,0,.25); }
#select { justify-content: flex-start; padding: max(18px, env(safe-area-inset-top)) 18px 18px; box-sizing: border-box; overflow-y: auto; background: rgba(20,18,32,.35); backdrop-filter: blur(2px); }
#select header { width: min(1100px, 100%); display: flex; align-items: center; justify-content: space-between; }
#select h2 { font-weight: 400; letter-spacing: .3em; text-transform: uppercase; font-size: clamp(16px, 2vw, 26px); margin: .4em 0; }
#grid { width: min(1100px, 100%); display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-top: 10px; }
.ch { position: relative; text-align: left; border-radius: 16px; overflow: hidden; aspect-ratio: 4/3; padding: 14px; box-sizing: border-box; display: flex; flex-direction: column; justify-content: flex-end; box-shadow: 0 8px 26px rgba(0,0,0,.28); }
.ch canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
.ch > * { position: relative; z-index: 1; }
.ch .n { font-size: 11px; letter-spacing: .4em; opacity: .9; }
.ch .t { font-size: clamp(17px, 1.6vw, 22px); letter-spacing: .1em; text-transform: uppercase; margin-top: 2px; }
.ch .s { font-style: italic; font-size: 13px; opacity: .9; margin-top: 2px; }
.ch .badge { position: absolute; top: 10px; right: 12px; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; padding: 4px 9px; border-radius: 99px; background: rgba(255,250,240,.88); color: #2a2238; text-shadow: none; }
.ch.locked { cursor: default; filter: saturate(.55); }
.ch.locked .badge { background: rgba(20,18,32,.55); color: #fff; }
.note { opacity: .8; font-style: italic; font-size: 14px; margin-top: 18px; }
#end { overflow-y: auto; justify-content: safe center; background: radial-gradient(ellipse at center, rgba(20,16,30,.35), rgba(20,16,30,.7)); padding: 20px; box-sizing: border-box; }
.endbox { max-width: min(820px, 92vw); margin: auto 0; padding: 40px 0 24px; }
@media (max-width: 600px) { .endbox .ar { font-size: 22px; line-height: 1.95; } .endbox .en { font-size: 15px; } .vocab div { min-width: 0; padding: 4px 9px; } .vocab .va { font-size: 19px; } .vocab .vt { font-size: 11px; } }
.endbox .ref { letter-spacing: .4em; text-transform: uppercase; font-size: clamp(11px, 1vw, 14px); opacity: .85; }
.endbox .ar { font-family: var(--ar); font-size: clamp(24px, 3.6vw, 44px); line-height: 2.1; margin: .5em 0 .2em; }
.endbox .en { font-style: italic; font-size: clamp(16px, 1.8vw, 23px); line-height: 1.45; margin: .3em 0; }
.endbox .cite { font-size: 12px; letter-spacing: .12em; opacity: .75; margin: .2em 0 1em; }
.vocab { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.vocab div { border: 1px solid rgba(255,255,255,.35); border-radius: 12px; padding: 6px 12px; min-width: 110px; }
.vocab .va { font-family: var(--ar); font-size: 24px; display: block; }
.vocab .vt { font-size: 12px; font-style: italic; opacity: .9; }
.lesson { font-size: clamp(15px, 1.6vw, 20px); margin-top: 1.1em; }
.lesson::before { content: "Lesson · "; letter-spacing: .2em; text-transform: uppercase; font-size: .7em; opacity: .8; }
.sheet { position: fixed; inset: 0; z-index: 20; background: rgba(10,9,16,.45); display: flex; align-items: flex-end; justify-content: center; }
.panel { position: relative; width: min(560px, 100%); max-height: 88vh; overflow-y: auto; background: #fbf5ea; color: #2a2238; border-radius: 22px 22px 0 0; padding: 26px 24px max(26px, env(safe-area-inset-bottom)); box-sizing: border-box; text-shadow: none; box-shadow: 0 -10px 40px rgba(0,0,0,.3); }
@media (min-width: 700px) { .sheet { align-items: center; } .panel { border-radius: 22px; } }
.panel h3 { margin: 0 0 .3em; font-weight: 400; letter-spacing: .12em; text-transform: uppercase; font-size: 20px; }
.panel p, .panel li { font-size: 15px; line-height: 1.5; }
.panel .x { position: absolute; top: 10px; right: 14px; font-size: 26px; color: #2a2238; }
.panel input { width: 100%; box-sizing: border-box; padding: 12px; border-radius: 10px; border: 1px solid #d8ccb8; font: inherit; background: #fff; margin: 6px 0; }
.panel .pill { background: #2a2238; color: #fbf5ea; margin-top: 10px; width: 100%; opacity: .55; cursor: not-allowed; }
.panel .stub { font-size: 12px; color: #8a6d3b; letter-spacing: .1em; text-transform: uppercase; }
.panel label.opt { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid #eadfcd; font-size: 15px; }
.panel small { color: #6b5f73; display: block; margin-top: 10px; line-height: 1.5; }
.panel a { color: #5b3f8a; }
