/* ui.css — HUD, dialogue, title, menus of Patchwork Realm. Everything in em (#ui font-size = 3% of height). */
#ui ::-webkit-scrollbar { display: none; }
#ui * { scrollbar-width: none; box-sizing: border-box; }
.gingham { background-color: #c8553d; background-image: linear-gradient(90deg, rgba(244,234,213,.55) 50%, transparent 50%), linear-gradient(rgba(244,234,213,.55) 50%, transparent 50%); background-size: 8px 8px; }
.stripes { background: repeating-linear-gradient(45deg, #e3b23c 0 4px, #c8553d 4px 8px); }
.corner { position: absolute; width: 1.1em; height: 1.1em; border: 2px solid var(--ink); border-radius: 3px; pointer-events: none; }
.corner.tl { left: -4px; top: -4px; } .corner.tr { right: -4px; top: -4px; } .corner.bl { left: -4px; bottom: -4px; } .corner.br { right: -4px; bottom: -4px; }
.fillbar { height: 0.6em; background: var(--ink); border-radius: 4px; border: 2px solid var(--ink); overflow: hidden; }
.fillbar > i { display: block; height: 100%; background: var(--sage); transition: width .25s; }
.fillbar.mp > i { background: #6f9ad0; } .fillbar.xp > i { background: var(--mustard); }

/* title */
.title { position: absolute; inset: 0; background: radial-gradient(ellipse at center, transparent 40%, rgba(20,18,36,.55)); cursor: pointer; }
.title-logo { position: absolute; left: 50%; top: 6%; transform: translateX(-50%); animation: logo-drop .8s cubic-bezier(.3,1.5,.5,1) both, logo-float 3.2s ease-in-out .8s infinite; pointer-events: none; text-align: center; white-space: nowrap; }
.title-logo .badge { position: relative; display: inline-block; padding: .18em .7em .28em; background: var(--madder); border: .12em dashed var(--linen); outline: .14em solid var(--ink); border-radius: .35em; transform: rotate(-4deg); box-shadow: 0 .22em 0 var(--ink); }
.title-logo .name { display: block; font-weight: 900; font-size: 4.2em; line-height: 1.05; letter-spacing: .04em; color: var(--linen);
  text-shadow: 0 .04em 0 #9c3f2c, 0 .08em 0 #9c3f2c, 0 .12em 0 #6e2a1e, .04em .16em 0 var(--ink), -.04em -.04em 0 var(--ink), .04em -.04em 0 var(--ink), -.04em .04em 0 var(--ink), .04em .04em 0 var(--ink); }
.title-logo .name.long { font-size: 3.3em; }
.title-logo .spool { position: absolute; top: -.55em; width: 1.1em; height: 1.1em; border-radius: 50%; background: var(--mustard); border: .16em solid var(--ink); box-shadow: inset 0 0 0 .18em #b8862a; }
.title-logo .spool.l { left: -.5em; } .title-logo .spool.r { right: -.5em; }
.title-tag { position: absolute; left: 0; right: 0; top: 38%; text-align: center; font-size: 1.3em; pointer-events: none; }
.title-prompt { position: absolute; left: 0; right: 0; bottom: 14%; text-align: center; font-size: 1.6em; animation: pulse 1.2s ease-in-out infinite; pointer-events: none; }
.title-cont { position: absolute; left: 0; right: 0; bottom: 8%; text-align: center; font-size: 1em; opacity: .85; pointer-events: none; }
@keyframes logo-drop { 0% { transform: translate(-50%, -140%); } 100% { transform: translate(-50%, 0); } }
@keyframes logo-float { 0%, 100% { margin-top: 0; } 50% { margin-top: 0.4em; } }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .45; transform: scale(1.04); } }

/* hud */
.hud { position: absolute; inset: 0; pointer-events: none !important; }
.hud > * { pointer-events: none; }
.hud .chips { position: absolute; left: 72px; top: 0.5em; display: flex; gap: 0.4em; }
.chip { position: relative; min-width: 5.6em; padding: 0.2em 0.5em 0.3em; background: var(--indigo); border: 2px solid var(--ink); border-radius: 7px; box-shadow: inset 0 0 0 2px #3d3b66, 0 3px 0 rgba(10,8,24,.5); font-size: 0.8em; }
.chip .nm { display: flex; justify-content: space-between; gap: 0.5em; white-space: nowrap; }
.chip .nm span:last-child { color: var(--mustard); }
.chip.dead { filter: grayscale(.8); }
.zonetab { position: absolute; left: 50%; top: 0; transform: translateX(-50%); padding: 0.25em 1.2em 0.35em; background: var(--indigo); border: 2px solid var(--ink); border-top: 0; border-radius: 0 0 10px 10px; box-shadow: inset 0 0 0 2px #3d3b66, 0 3px 0 rgba(10,8,24,.5); font-size: 0.95em; white-space: nowrap; }
.zonetab::after { content: ""; position: absolute; left: 6px; right: 6px; bottom: 3px; border-bottom: 2px dashed rgba(244,234,213,.4); }
.hud .money { position: absolute; right: 72px; top: 0.5em; display: flex; gap: 0.5em; align-items: center; }
.moneybox { display: flex; align-items: center; gap: 0.35em; padding: 0.2em 0.7em 0.25em 0.3em; background: var(--indigo); border: 2px solid var(--ink); border-radius: 999px; box-shadow: inset 0 0 0 2px #3d3b66, 0 3px 0 rgba(10,8,24,.5); font-size: 1em; min-height: 1.7em; }
.moneybox img { width: 1.3em; height: 1.3em; }
.coin { width: 1.3em; height: 1.3em; border-radius: 50%; border: 2px solid var(--ink); background:
  radial-gradient(circle at 35% 35%, var(--ink) 0 9%, transparent 11%), radial-gradient(circle at 65% 35%, var(--ink) 0 9%, transparent 11%),
  radial-gradient(circle at 35% 65%, var(--ink) 0 9%, transparent 11%), radial-gradient(circle at 65% 65%, var(--ink) 0 9%, transparent 11%), var(--mustard); box-shadow: inset 0 -2px 0 rgba(0,0,0,.25); flex: none; }
.hud .money .btn { pointer-events: auto; font-size: 0.85em; }

/* dialogue */
.dlg { left: 8%; right: 8%; bottom: 3%; height: 20%; padding: 0.9em 1.3em 0.7em; cursor: pointer; overflow: visible; }
.dlg-name { position: absolute; left: 1.2em; top: -1.15em; padding: 0.15em 1em 0.2em; border: 3px solid var(--ink); border-radius: 8px 8px 0 0; font-size: 1em; box-shadow: inset 0 2px 0 rgba(255,255,255,.25); }
.dlg-text { position: relative; height: 100%; overflow: hidden; font-size: 1.05em; line-height: 1.4; line-break: strict; overflow-wrap: anywhere; word-break: normal; padding-right: 1.5em; }
.dlg-arrow { position: absolute; right: 1.2em; bottom: 0.6em; font-size: 1.1em; color: var(--mustard); animation: bob .6s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(0.3em); } }
.choice { position: absolute; right: 4%; bottom: 31%; display: flex; flex-direction: column; gap: 8px; min-width: 14em; max-width: 60%; }
.choice .btn { justify-content: flex-start; padding: 0.4em 1.1em; }

/* toast / banner / fade */
.toast { position: absolute; left: 50%; top: 3.4em; transform: translateX(-50%); padding: 0.3em 1.2em 0.4em; font-size: 0.95em; white-space: nowrap; max-width: 80%; background: var(--indigo); border: 2px solid var(--ink); border-radius: 8px; box-shadow: inset 0 0 0 2px #3d3b66, 0 3px 0 rgba(10,8,24,.5); animation: toast-in .25s ease-out both; pointer-events: none !important; }
.toast.out { animation: toast-out .25s ease-in both; }
@keyframes toast-in { 0% { transform: translate(-50%, -150%); opacity: 0; } 100% { transform: translate(-50%, 0); opacity: 1; } }
@keyframes toast-out { 0% { opacity: 1; } 100% { transform: translate(-50%, -100%); opacity: 0; } }
.banner { position: absolute; left: 0; right: 0; top: 36%; height: 26%; display: flex; flex-direction: column; align-items: center; justify-content: center; background: linear-gradient(var(--madder), #a63f2b); border-top: 4px solid var(--ink); border-bottom: 4px solid var(--ink); box-shadow: 0 0 0 3px rgba(244,234,213,.5) inset, 0 6px 0 rgba(10,8,24,.5); animation: banner-in .45s cubic-bezier(.2,1.4,.4,1) both; pointer-events: none !important; }
.banner::before, .banner::after { content: ""; position: absolute; left: 0; right: 0; height: 0.5em; background: repeating-linear-gradient(90deg, var(--linen) 0 10px, transparent 10px 20px); opacity: .55; }
.banner::before { top: 0.5em; } .banner::after { bottom: 0.5em; }
.banner.out { animation: banner-out .4s ease-in both; }
.banner .t { font-size: 2.6em; letter-spacing: 0.05em; } .banner .s { font-size: 1.2em; margin-top: 0.2em; }
@keyframes banner-in { 0% { transform: scale(2.2, .2); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes banner-out { 0% { transform: translateX(0); } 100% { transform: translateX(110%); } }
.fade { position: absolute; inset: 0; background: var(--ink); opacity: 0; pointer-events: none !important; z-index: 50; transition: opacity .3s; }
.fade.on { pointer-events: auto !important; }

/* game over / ending */
.gover { position: absolute; inset: 0; z-index: 40; background: rgba(27,10,20,.82); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5em; animation: fade-in .5s both; }
.gover .big { font-size: 3.4em; color: var(--madder); letter-spacing: .06em; animation: pop-in .5s both; }
.gover .line { font-size: 1.1em; margin-bottom: 0.6em; text-align: center; padding: 0 8%; }
.gover .col { display: flex; flex-direction: column; gap: 10px; min-width: 15em; }
.gover .col .btn img { width: 1.6em; height: 1.6em; }
@keyframes fade-in { 0% { opacity: 0; } 100% { opacity: 1; } }
.ending { position: absolute; inset: 0; z-index: 40; background: radial-gradient(ellipse at center, #3d3b66, var(--ink) 85%); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.6em; animation: fade-in .8s both; text-align: center; }
.ending .big { font-size: 2.8em; color: var(--mustard); animation: pop-in .6s both; }
.ending .line { font-size: 1.15em; padding: 0 12%; line-height: 1.5; }
.ending .stats { display: flex; gap: 1.2em; flex-wrap: wrap; justify-content: center; margin: 0.4em 0 0.6em; }
.ending .stat { padding: 0.3em 0.9em; background: var(--indigo); border: 2px dashed rgba(244,234,213,.5); border-radius: 8px; font-size: 1em; }
.ending .stat b { color: var(--mustard); }

/* menus */
.menu-ov { position: absolute; inset: 0; z-index: 30; background: rgba(20,18,36,.55); }
.mp { z-index: 31; display: flex; flex-direction: column; }
.mp .close { position: absolute; right: 0.6em; top: 0.6em; width: 44px; min-width: 44px; padding: 0; z-index: 3; }
.mp .head { display: flex; gap: 8px; align-items: center; padding-right: 54px; flex: none; position: relative; z-index: 2; flex-wrap: wrap; }
.mp .head .btn { font-size: 0.9em; }
.mp .head .btn.sel { box-shadow: inset 0 0 0 3px var(--mustard), 0 4px 0 var(--ink); }
.mp .title { position: static; background: none; font-size: 1.2em; cursor: default; padding-right: 0.8em; }
.mp .body { flex: 1; display: flex; gap: 0.8em; min-height: 0; margin-top: 0.6em; position: relative; z-index: 2; }
.mcol { flex: none; width: 22%; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; padding: 4px 4px 8px; }
.mcol .btn { justify-content: space-between; font-size: 0.95em; }
.mcol .btn.sel { box-shadow: inset 0 0 0 3px var(--mustard), 0 4px 0 var(--ink); }
.mcontent { flex: 1; overflow-y: auto; padding: 4px 6px 8px; min-width: 0; display: flex; flex-direction: column; gap: 0.5em; }
.row { display: flex; align-items: center; gap: 0.6em; flex-wrap: wrap; }
.row .grow { flex: 1; min-width: 6em; }
.sub { font-size: 0.8em; opacity: .85; font-weight: 700; }
.h2 { font-size: 1.15em; color: var(--mustard); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.3em 1em; }
.stats div { display: flex; justify-content: space-between; padding: 0.15em 0.5em; background: rgba(27,26,46,.5); border-radius: 6px; font-size: 0.95em; }
.stats .g0 { color: var(--madder); } .stats .g1 { color: #8fb0d8; } .stats .g2 { color: var(--sage); } .stats .g3 { color: var(--mustard); }
.card { background: rgba(27,26,46,.45); border: 2px dashed rgba(244,234,213,.3); border-radius: 8px; padding: 0.4em 0.7em; }
.tree { display: grid; grid-template-columns: 1fr 1fr; gap: 0.2em 1.4em; position: relative; }
.tcol { display: flex; flex-direction: column; align-items: stretch; gap: 14px; position: relative; }
.tcol::before { content: ""; position: absolute; left: 50%; top: 10%; bottom: 10%; border-left: 3px dashed rgba(244,234,213,.45); z-index: 0; }
.trow { display: flex; gap: 8px; justify-content: center; position: relative; z-index: 1; }
.node { flex-direction: column; min-width: 6em; flex: 1; font-size: 0.9em; line-height: 1.15; padding: 0.3em 0.5em; text-align: center; }
.node .c { font-size: 0.8em; color: var(--mustard); }
.node.have { background: linear-gradient(#f0cd6c, #d6a22e); color: var(--ink); text-shadow: none; box-shadow: 0 0 12px var(--mustard), 0 4px 0 var(--ink); }
.node.have .c { color: var(--ink); }
.node.off { }
.node.sel2 { }
.mapgrid { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 8px; flex: 1; min-height: 0; }
.patch { position: relative; border: 3px dashed rgba(244,234,213,.55); border-radius: 6px; display: flex; align-items: center; justify-content: center; text-align: center; padding: 0.3em; font-size: 0.95em; box-shadow: inset 0 0 0 2px rgba(27,26,46,.5); }
.patch.unk { background: #6a6a74; color: #c9c9d0; font-size: 1.6em; } .patch.none { border-color: transparent; box-shadow: none; }
.pin { position: absolute; right: 0.3em; top: 0.1em; width: 0.9em; height: 0.9em; background: var(--madder); border: 2px solid var(--ink); border-radius: 50% 50% 50% 0; transform: rotate(-45deg); animation: pinpulse 1s ease-in-out infinite; }
@keyframes pinpulse { 0%, 100% { transform: rotate(-45deg) scale(1); } 50% { transform: rotate(-45deg) scale(1.3); } }
.small { z-index: 31; text-align: center; }
.small .row { justify-content: center; }
.burst { position: absolute; width: 8px; height: 8px; background: var(--mustard); border-radius: 50%; pointer-events: none; z-index: 60; animation: burst .6s ease-out forwards; }
.burst.sq { border-radius: 2px; background: #fff3b0; }
@keyframes burst { 0% { transform: translate(0, 0) scale(1); opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) scale(.2); opacity: 0; } }
