:root {
  --ink: #2f2116; --ink2: #6b5440; --paper: #f5ead3; --paper2: #ecdcbc; --card: #fbf4e4;
  --line: #d7c19b; --terra: #b5482f; --terra2: #8f3320; --gold: #c99a2e; --gold2: #f2d27a;
  --green: #5a7d3a; --blue: #3d6b8c; --night: #2b1d14; --red: #a3322a;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "Noto Serif", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  --r: 16px; --shadow: 0 1px 0 #fff8 inset, 0 6px 18px -8px #5a3a1a66;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--night); color: var(--ink); font-family: var(--sans); overscroll-behavior: none; }
body { -webkit-user-select: none; user-select: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; touch-action: manipulation; }
.hidden { display: none !important; }
h1, h2, h3, .serif { font-family: var(--serif); letter-spacing: .2px; }

#app { position: fixed; inset: 0; display: flex; flex-direction: column; max-width: 520px; margin: 0 auto;
  background: radial-gradient(120% 60% at 50% 0%, #fff6e0 0%, var(--paper) 45%, var(--paper2) 100%); }
#app::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .35; mix-blend-mode: multiply;
  background-image: radial-gradient(#c9ad7f 0.6px, transparent 0.7px), radial-gradient(#d9c39a 0.5px, transparent 0.6px);
  background-size: 7px 7px, 11px 11px; background-position: 0 0, 3px 5px; }

/* top bar */
#top { position: relative; z-index: 5; padding: calc(8px + var(--safe-t)) 12px 8px; color: #f8ecd2;
  background: linear-gradient(180deg, #3a271a, #2b1d14); box-shadow: 0 4px 14px -6px #000a; }
.top-row { display: flex; align-items: center; gap: 10px; }
.crest { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 22px;
  background: radial-gradient(circle at 35% 30%, #ffffff33, transparent 60%), var(--c, var(--terra)); box-shadow: 0 0 0 2px var(--gold), 0 3px 8px #0008; }
.top-title { flex: 1; min-width: 0; }
.top-title b { display: block; font-family: var(--serif); font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-title small { opacity: .75; font-size: 12px; }
.score { text-align: right; font-size: 11px; opacity: .85; }
.score b { display: block; font-family: var(--serif); font-size: 18px; color: var(--gold2); }
.icon-btn { width: 34px; height: 34px; border-radius: 10px; background: #ffffff14; font-size: 17px; }
.res-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; }
.chip { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 5px 4px; border-radius: 10px; background: #ffffff12;
  font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; transition: transform .2s; }
.chip.bump { animation: bump .6s ease; }
.chip .d { font-size: 10px; font-weight: 600; opacity: .8; }
.chip .d.pos { color: #a6e07a; } .chip .d.neg { color: #ff9b85; }
@keyframes bump { 0% { transform: scale(1); } 30% { transform: scale(1.15); background: #f2d27a44; } 100% { transform: scale(1); } }

/* main view */
#view { position: relative; flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px 12px calc(150px + var(--safe-b)); -webkit-overflow-scrolling: touch; scroll-behavior: smooth; }
.view-enter { animation: fadeUp .35s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 18px 4px 8px; }
.section-title h2 { margin: 0; font-size: 19px; }
.section-title small { color: var(--ink2); font-size: 12px; }
.card { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 12px; }
.muted { color: var(--ink2); font-size: 13px; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }

/* head card */
.head-card { display: grid; grid-template-columns: auto 1fr; gap: 12px; padding: 14px;
  background: linear-gradient(160deg, #fffaf0, #f3e3c3); }
.avatar { position: relative; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-size: 28px; flex: none;
  background: radial-gradient(circle at 35% 30%, #fff8, transparent 60%), var(--c, #d9b98a); box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--line); }
.avatar.big { width: 72px; height: 72px; font-size: 40px; }
.avatar.sm { width: 40px; height: 40px; font-size: 22px; }
.avatar .crown { position: absolute; top: -12px; left: 50%; transform: translateX(-50%) rotate(-8deg); font-size: 18px; filter: drop-shadow(0 1px 1px #0006); }
.avatar.dead { filter: grayscale(1); opacity: .6; }
.head-name { font-family: var(--serif); font-size: 22px; font-weight: 700; line-height: 1.1; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.tag { font-size: 11.5px; padding: 3px 7px; border-radius: 999px; background: #efe0c1; border: 1px solid var(--line); white-space: nowrap; }
.tag.red { background: #f6d6cc; border-color: #e3a898; color: #7a2316; }
.tag.green { background: #dfecc9; border-color: #b6cf91; color: #36521c; }
.tag.gold { background: #f8e7b0; border-color: #e2c470; color: #6a4b06; }
.tag.blue { background: #d6e6f2; border-color: #a5c3da; color: #1f4867; }
.stages { grid-column: 1 / -1; display: flex; align-items: center; gap: 0; margin-top: 4px; }
.stage { flex: 1; text-align: center; font-size: 10.5px; color: var(--ink2); position: relative; padding-top: 22px; }
.stage::before { content: attr(data-i); position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 20px; height: 20px; line-height: 20px; border-radius: 50%; background: #e6d3ae; font-size: 11px; }
.stage::after { content: ""; position: absolute; top: 9px; left: calc(50% + 12px); right: calc(-50% + 12px); height: 2px; background: #e0cba3; }
.stage:last-child::after { display: none; }
.stage.done::before { background: var(--gold); }
.stage.now { color: var(--ink); font-weight: 700; }
.stage.now::before { background: var(--terra); box-shadow: 0 0 0 3px #b5482f44; animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px #b5482f11; } }
.stats3 { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: #fff9ec; border: 1px solid var(--line); border-radius: 12px; padding: 7px 8px; text-align: center; }
.stat b { display: block; font-family: var(--serif); font-size: 18px; }
.stat span { font-size: 11px; color: var(--ink2); }
.secret { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 12px;
  background: repeating-linear-gradient(-45deg, #3a271a, #3a271a 8px, #402b1d 8px, #402b1d 16px); color: #f3e2c0; }
.secret .s-ico { font-size: 22px; }
.secret b { font-family: var(--serif); }
.secret .btn { margin-left: auto; }

/* village scene */
.scene { position: relative; margin-top: 12px; border-radius: var(--r); overflow: hidden; border: 1px solid #b99a6b; box-shadow: var(--shadow); background: #9cc6d8; }
.scene svg { display: block; width: 100%; height: auto; }
.scene-badge { position: absolute; left: 10px; top: 10px; padding: 5px 10px; border-radius: 999px; background: #2b1d14cc; color: #fbeed2; font-size: 12px; font-weight: 600; backdrop-filter: blur(4px); }
.scene-badge.r { left: auto; right: 10px; }
.cloud { animation: drift 40s linear infinite; }
.cloud.c2 { animation-duration: 60s; animation-delay: -20s; }
@keyframes drift { from { transform: translateX(-120px); } to { transform: translateX(420px); } }
.smoke { animation: smoke 3.5s ease-in infinite; transform-box: fill-box; transform-origin: center; }
@keyframes smoke { 0% { opacity: .0; transform: translateY(0) scale(.6); } 20% { opacity: .7; } 100% { opacity: 0; transform: translateY(-22px) scale(1.6); } }
.bld { transform-box: fill-box; transform-origin: center bottom; animation: pop .5s cubic-bezier(.3,1.6,.5,1) both; }
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }
.sway { animation: sway 4s ease-in-out infinite; transform-box: fill-box; transform-origin: bottom center; }
@keyframes sway { 50% { transform: rotate(3deg); } }

.bars { display: grid; gap: 8px; margin-top: 10px; }
.bar { font-size: 12px; }
.bar .lbl { display: flex; justify-content: space-between; margin-bottom: 3px; color: var(--ink2); }
.bar .lbl b { color: var(--ink); }
.track { height: 9px; border-radius: 9px; background: #e5d2ad; overflow: hidden; box-shadow: inset 0 1px 2px #0002; }
.fill { height: 100%; border-radius: 9px; background: linear-gradient(90deg, var(--gold), #e8b94a); transition: width .8s cubic-bezier(.2,.8,.2,1); }
.fill.terra { background: linear-gradient(90deg, var(--terra2), var(--terra)); }
.fill.green { background: linear-gradient(90deg, #47682b, #79a450); }

/* build grid */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bcard { display: flex; flex-direction: column; gap: 4px; padding: 10px; text-align: left; border-radius: 14px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); transition: transform .12s; }
.bcard:active { transform: scale(.97); }
.bcard .top { display: flex; align-items: center; gap: 8px; }
.bcard .ico { font-size: 26px; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: #f1e2c4; }
.bcard b { font-family: var(--serif); font-size: 15px; }
.lv { display: flex; gap: 3px; margin-top: 2px; }
.lv i { width: 9px; height: 9px; border-radius: 50%; background: #e2cfa9; }
.lv i.on { background: var(--gold); box-shadow: 0 0 0 1px #a77b17 inset; }
.cost { display: flex; flex-wrap: wrap; gap: 4px; font-size: 12px; font-weight: 600; }
.cost span.no { color: var(--red); }
.bcard .desc { font-size: 11.5px; color: var(--ink2); line-height: 1.3; }
.bcard.locked { opacity: .55; filter: saturate(.4); }
.bcard.cant .cost { opacity: .9; }
.bcard.max { background: linear-gradient(160deg, #fff6d8, #f6e2a8); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 14px; border-radius: 12px; font-weight: 700; font-size: 14px;
  background: var(--terra); color: #fff6e6; box-shadow: 0 2px 0 var(--terra2), 0 6px 12px -6px #8f332099; transition: transform .1s, filter .1s; }
.btn:active { transform: translateY(2px); box-shadow: 0 0 0 var(--terra2); }
.btn.sec { background: #efe0c1; color: var(--ink); box-shadow: 0 2px 0 #cdb58a; }
.btn.gold { background: linear-gradient(180deg, #f2d27a, #c99a2e); color: #3a2405; box-shadow: 0 2px 0 #8a6612; }
.btn.dark { background: #3a271a; color: #f3e2c0; box-shadow: 0 2px 0 #1b120c; }
.btn.sm { padding: 6px 10px; font-size: 12.5px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn[disabled], .btn.disabled { filter: grayscale(.8); opacity: .5; pointer-events: none; }

/* fab */
.fab { position: absolute; z-index: 6; left: 50%; bottom: calc(76px + var(--safe-b)); transform: translateX(-50%); display: flex; align-items: center; gap: 8px;
  padding: 13px 24px 13px 16px; border-radius: 999px; font-family: var(--serif); font-size: 18px; font-weight: 700; color: #3a2405;
  background: linear-gradient(180deg, #ffe7a3, #e2ac3a); white-space: nowrap; box-shadow: 0 3px 0 #9b7016, 0 10px 24px -8px #6a4b06cc, 0 0 0 3px #fff3; transition: transform .12s; }
.fab:active { transform: translateX(-50%) translateY(3px); box-shadow: 0 0 0 #9b7016; }
.fab-sun { display: inline-block; font-size: 22px; animation: spin 12s linear infinite; }
.fab.wait { filter: grayscale(.6); }
@keyframes spin { to { transform: rotate(360deg); } }

/* tabs */
#tabs { position: relative; z-index: 6; display: grid; grid-template-columns: repeat(4, 1fr); padding: 6px 6px calc(6px + var(--safe-b)); background: #2b1d14; box-shadow: 0 -4px 14px -6px #000a; }
#tabs button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; border-radius: 12px; color: #cdb791; font-size: 11.5px; font-weight: 600; transition: background .2s, color .2s; }
#tabs button span { font-size: 21px; transition: transform .2s; }
#tabs button.on { color: #fff2d4; background: #ffffff14; }
#tabs button.on span { transform: translateY(-2px) scale(1.1); }

/* family */
.tree-wrap { overflow-x: auto; overflow-y: hidden; margin: 0 -12px; padding: 8px 12px 16px; -webkit-overflow-scrolling: touch; }
.tree, .tree ul { display: flex; justify-content: center; padding: 0; margin: 0; list-style: none; }
.tree ul { padding-top: 18px; position: relative; }
.tree li { position: relative; padding: 18px 4px 0; display: flex; flex-direction: column; align-items: center; }
.tree > li { padding-top: 0; }
.tree li::before, .tree li::after { content: ""; position: absolute; top: 0; height: 18px; border-top: 2px solid #b99a6b; width: 50%; }
.tree li::before { right: 50%; } .tree li::after { left: 50%; border-left: 2px solid #b99a6b; }
.tree li:only-child::before, .tree li:only-child::after { border-top: 0; }
.tree li:only-child::after { border-left: 2px solid #b99a6b; }
.tree li:first-child::before, .tree li:last-child::after { border-top: 0; }
.tree li:last-child::before { border-right: 2px solid #b99a6b; border-radius: 0 8px 0 0; }
.tree li:first-child::after { border-radius: 8px 0 0 0; }
.tree > li::before, .tree > li::after { display: none; }
.tree ul::before { content: ""; position: absolute; top: 0; left: 50%; height: 18px; border-left: 2px solid #b99a6b; }
.couple { display: flex; align-items: center; gap: 2px; padding: 5px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.couple.line { border-color: var(--gold); box-shadow: 0 0 0 2px #c99a2e55, var(--shadow); }
.couple .heart { font-size: 11px; color: var(--terra); }
.pnode { display: flex; flex-direction: column; align-items: center; width: 64px; padding: 2px; border-radius: 10px; }
.pnode .nm { font-size: 11.5px; font-weight: 700; margin-top: 3px; max-width: 62px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pnode .sub { font-size: 10px; color: var(--ink2); white-space: nowrap; }
.pnode.dead .nm { color: #8a7a6a; text-decoration: line-through; text-decoration-color: #8a7a6a88; }
.pnode.branch { opacity: .65; }
.legend { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.member { display: flex; align-items: center; gap: 10px; padding: 9px 10px; text-align: left; width: 100%; }
.member + .member { border-top: 1px dashed var(--line); }

/* world */
.map { position: relative; border-radius: var(--r); overflow: hidden; border: 1px solid #b99a6b; box-shadow: var(--shadow); }
.map svg { display: block; width: 100%; height: auto; }
.ncard { display: flex; flex-direction: column; gap: 8px; text-align: left; width: 100%; }
.ncard + .ncard { margin-top: 8px; }
.op { height: 7px; border-radius: 7px; background: linear-gradient(90deg, #c0533c, #e3cf9f 50%, #6f9a48); position: relative; }
.op i { position: absolute; top: -3px; width: 4px; height: 13px; border-radius: 2px; background: var(--ink); transform: translateX(-50%); box-shadow: 0 0 0 2px #fff; }

/* chronicle */
.chron { list-style: none; margin: 0; padding: 0; }
.chron li { display: grid; grid-template-columns: 46px 1fr; gap: 8px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; line-height: 1.35; }
.chron li .y { font-family: var(--serif); font-weight: 700; color: var(--terra2); }
.chron li.milestone { font-weight: 700; } .chron li.death { color: #5c4a3c; } .chron li.war { color: #7a2316; }
.heads { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 10px; }
.headchip { flex: none; width: 92px; text-align: center; }
.headchip .nm { font-family: var(--serif); font-weight: 700; font-size: 13px; margin-top: 4px; }
.headchip .sub { font-size: 11px; color: var(--ink2); }

/* sheet */
#sheetWrap { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.scrim { position: absolute; inset: 0; background: #1a0f08aa; animation: fade .2s ease both; }
#sheet { position: relative; width: 100%; max-width: 520px; max-height: 86vh; overflow-y: auto; padding: 10px 14px calc(18px + var(--safe-b)); border-radius: 22px 22px 0 0;
  background: var(--paper); box-shadow: 0 -10px 30px #0008; animation: up .32s cubic-bezier(.2,.9,.2,1) both; }
#sheet::before { content: ""; display: block; width: 44px; height: 5px; border-radius: 5px; background: #cdb58a; margin: 0 auto 10px; }
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fade { from { opacity: 0; } }
.sheet-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.sheet-head h3 { margin: 0; font-size: 21px; }
.prof-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.prof { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px; border-radius: 12px; background: #efe0c1; font-size: 11.5px; font-weight: 600; border: 2px solid transparent; }
.prof span { font-size: 22px; }
.prof.on { border-color: var(--terra); background: #fff4df; }
.prof.locked { opacity: .4; }
.cand { display: flex; align-items: center; gap: 10px; padding: 9px; }
.cand + .cand { border-top: 1px dashed var(--line); }
.deal { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; }
.deal + .deal { border-top: 1px dashed var(--line); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; font-size: 13.5px; }
.kv b { text-align: right; }

/* modal (event cards) */
#modalWrap { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 18px; background: radial-gradient(circle at 50% 40%, #2b1d14cc, #0d0805ee); animation: fade .25s ease both; }
#modal { width: 100%; max-width: 420px; max-height: 92vh; overflow-y: auto; border-radius: 22px; background: var(--paper); box-shadow: 0 20px 50px #000c, 0 0 0 1px #fff2 inset;
  animation: cardIn .5s cubic-bezier(.2,1.2,.3,1) both; }
@keyframes cardIn { from { opacity: 0; transform: perspective(800px) rotateX(18deg) translateY(30px) scale(.92); } to { opacity: 1; transform: none; } }
.m-art { position: relative; height: 128px; display: grid; place-items: center; font-size: 64px; overflow: hidden;
  background: radial-gradient(circle at 50% 120%, #f2d27a 0%, #c0653a 45%, #4a2a1a 100%); }
.m-art.cool { background: radial-gradient(circle at 50% 120%, #b9dce8 0%, #3d6b8c 50%, #1d2c3a 100%); }
.m-art.dark { background: radial-gradient(circle at 50% 120%, #8a6a9e 0%, #3b2346 55%, #140b18 100%); }
.m-art.green { background: radial-gradient(circle at 50% 120%, #d7e9a8 0%, #5a7d3a 50%, #1f2c14 100%); }
.m-art .glyph { filter: drop-shadow(0 6px 10px #0007); animation: float 3s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-6px); } }
.m-art .kicker { position: absolute; top: 10px; left: 12px; font-size: 11px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: #fff9; }
.m-body { padding: 16px 16px 18px; }
.m-body h2 { margin: 0 0 6px; font-size: 24px; }
.m-body p { margin: 0 0 14px; font-size: 15px; line-height: 1.45; color: #4a3828; }
.choices { display: grid; gap: 8px; }
.choice { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 14px; border-radius: 14px; text-align: left; background: var(--card); border: 1px solid var(--line); box-shadow: 0 2px 0 #d7c19b; transition: transform .1s; }
.choice b { font-size: 15px; } .choice small { font-size: 12px; color: var(--ink2); }
.choice:active { transform: translateY(2px); box-shadow: none; }
.choice.no { opacity: .45; pointer-events: none; }
.choice.new { border-color: var(--gold); }
.choice.new b::after { content: " ✦ yeni"; font-size: 11px; color: var(--gold); }
.heir-opt { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; border-radius: 14px; background: var(--card); border: 2px solid var(--line); text-align: left; }
.heir-opt + .heir-opt { margin-top: 8px; }
.heir-opt.sel { border-color: var(--gold); background: #fff6d8; }
.inh { display: grid; gap: 8px; margin-bottom: 14px; }
.inh .it { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); font-size: 14px; }
.inh .it .ic { font-size: 22px; width: 30px; text-align: center; }

#yearFx { position: fixed; inset: 0; z-index: 25; display: grid; place-items: center; pointer-events: none; }
#yearFx .yr { font-family: var(--serif); font-size: 54px; font-weight: 700; color: #fff2d4; text-shadow: 0 4px 20px #000c; animation: yr 1.1s ease both; }
#yearFx::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle, #2b1d1499, #0d0805dd); animation: yrbg 1.1s ease both; }
@keyframes yr { 0% { opacity: 0; transform: scale(.7); } 30% { opacity: 1; transform: scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: scale(1.1); } }
@keyframes yrbg { 0%, 100% { opacity: 0; } 30%, 70% { opacity: 1; } }

#toast { position: fixed; z-index: 40; left: 50%; bottom: calc(140px + var(--safe-b)); transform: translateX(-50%) translateY(20px); max-width: min(92vw, 460px); padding: 11px 16px; border-radius: 14px;
  background: #2b1d14f2; color: #fbeed2; font-size: 14px; line-height: 1.35; box-shadow: 0 10px 30px #0009; opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none; text-align: center; }
#toast.on { opacity: 1; transform: translateX(-50%); }
#toast.bad { background: #7a2316f2; }

/* title */
#title { position: fixed; inset: 0; z-index: 50; overflow-y: auto; color: #f8ecd2; background: radial-gradient(120% 70% at 50% 10%, #7a3a22 0%, #3a271a 45%, #140c07 100%); }
#title.hidden { display: none; }
.t-inner { max-width: 440px; margin: 0 auto; padding: calc(40px + var(--safe-t)) 22px calc(30px + var(--safe-b)); display: flex; flex-direction: column; min-height: 100%; }
.logo { text-align: center; margin-top: 4vh; }
.logo img { width: 112px; height: 112px; border-radius: 28px; box-shadow: 0 12px 40px #000a, 0 0 0 2px #f2d27a55; animation: float 4s ease-in-out infinite; }
.logo h1 { font-size: 52px; margin: 14px 0 4px; letter-spacing: 2px; background: linear-gradient(180deg, #ffe9a8, #c99a2e); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo p { margin: 0; opacity: .8; font-family: var(--serif); font-style: italic; font-size: 16px; }
.t-actions { margin-top: auto; display: grid; gap: 10px; padding-top: 30px; }
.t-card { background: #ffffff0d; border: 1px solid #ffffff1f; border-radius: 18px; padding: 16px; margin-top: 24px; }
.t-card label { display: block; font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; opacity: .7; margin: 12px 0 6px; }
.t-card label:first-child { margin-top: 0; }
.t-card input { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid #ffffff2a; background: #00000033; color: #fff; font: 600 16px var(--sans); outline: none; }
.t-card input:focus { border-color: var(--gold); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.seg button { padding: 10px; border-radius: 12px; background: #00000033; border: 1px solid #ffffff2a; font-weight: 700; }
.seg button.on { background: #f2d27a; color: #3a2405; border-color: #f2d27a; }
.crests { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.crests button { font-size: 24px; padding: 8px 0; border-radius: 12px; background: #00000033; border: 1px solid #ffffff2a; }
.crests button.on { background: #f2d27a33; border-color: #f2d27a; transform: scale(1.06); }
.pill-list { display: grid; gap: 6px; font-size: 13.5px; opacity: .9; margin-top: 18px; }
.pill-list div { display: flex; gap: 8px; align-items: center; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* v2: multi-year advance, neighbours screen, optional cards, share */
.fab-label small { font-family: var(--sans); font-size: 12px; font-weight: 700; opacity: .7; margin-left: 4px; }
.fab-mini { position: absolute; z-index: 6; right: 14px; bottom: calc(80px + var(--safe-b)); width: 50px; height: 50px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: var(--serif); font-weight: 700; font-size: 17px; line-height: 1; color: #f3e2c0; background: #3a271a; box-shadow: 0 3px 0 #1b120c, 0 8px 18px -8px #000c; transition: transform .12s; }
.fab-mini small { font-family: var(--sans); font-size: 10px; opacity: .75; }
.fab-mini:active { transform: translateY(3px); }
.choice.skip { background: transparent; box-shadow: none; border-style: dashed; align-items: center; }
.choice.skip b { font-size: 14px; color: var(--ink2); } .choice.skip small { display: none; }
.nb-list { display: grid; gap: 10px; max-height: 52vh; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.nb-item { padding: 10px 12px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); animation: nbIn .35s ease both; }
.nb-item:nth-child(2) { animation-delay: .06s } .nb-item:nth-child(3) { animation-delay: .12s } .nb-item:nth-child(4) { animation-delay: .18s }
.nb-item.must:not(.done) { border-color: var(--red); box-shadow: 0 0 0 2px #b5482f22; }
.nb-item.done { opacity: .8; }
.nb-item p { margin: 6px 0 8px; font-size: 13.5px; }
.nb-h { display: flex; gap: 10px; align-items: center; }
.nb-h .crest { width: 34px; height: 34px; font-size: 18px; flex: none; }
.nb-h b { display: block; font-size: 15px; } .nb-h small { font-size: 12px; color: var(--ink2); }
.nb-ch { display: flex; flex-wrap: wrap; gap: 6px; }
.nb-ch .btn { display: flex; flex-direction: column; align-items: flex-start; text-align: left; }
.nb-ch .btn small { font-size: 10.5px; font-weight: 600; opacity: .75; }
.nb-res { font-size: 13px; color: #3f6b2a; font-weight: 600; }
@keyframes nbIn { from { opacity: 0; transform: translateY(8px); } }
.share-btn { margin: 2px 0 4px; }
#yearFx .yr small { display: block; font-size: 20px; text-align: center; opacity: .75; }
