/* tavern cards on small phones: the name keeps its own line height instead of being squeezed under the tags */
.compact .pp-card .nm { line-height: 1.15; min-height: 1.15em; position: relative; top: -3px; }
.compact .pp-top .lq-ribbon { padding-left: 12px !important; padding-right: 12px !important; flex-shrink: 0; }
.compact .pp-next { margin-top: 7px; }
.compact .pp-card { row-gap: 0; }
.uc-codex .sc-panel, .uc-train .sc-panel { width: min(96vw, calc(900px*var(--m))); gap: 6px; }
.uc-drawres .sc-panel { width: min(96vw, calc(820px*var(--m))); gap: 8px; padding-bottom: 12px; align-items: center; }
.uc-hstat { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 18px; background: rgba(0,0,0,.5); border: 2px solid var(--gold-dark); font-size: 16px; color: var(--gold-hi); white-space: nowrap; }
.uc-cicon { width: 24px; height: 24px; object-fit: contain; flex: none; }
.uc-cicon.sm { width: 18px; height: 18px; }
.uc-note { font-size: 12px; font-weight: 700; color: #e9d3a8; text-align: center; line-height: 1.25; text-shadow: 0 1px 0 #2a0805; word-break: keep-all; overflow-wrap: anywhere; line-break: strict; }
.uc-note.left { text-align: left; } .uc-note.on { color: #8ff0b0; }
.uc-bonus { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 100%; }
.uc-chips, .uc-brk { display: flex; flex-wrap: wrap; gap: 4px 6px; justify-content: center; }
.uc-brk { justify-content: flex-start; }
.uc-chip { font-size: 13px; padding: 1px 10px; border-radius: 12px; background: rgba(0,0,0,.5); border: 1px solid var(--gold); color: var(--gold-hi); text-shadow: var(--outline); }
.uc-chip.dim { opacity: .55; border-color: var(--gold-dark); }
.uc-body { display: flex; gap: 8px; width: 100%; flex: 1 1 auto; min-height: 0; }
.uc-grid { flex: 1 1 52%; min-width: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 5px; align-content: start; overflow: hidden auto; scrollbar-width: none; max-height: min(52vh, 420px); padding: 6px; border-radius: 10px; background: rgba(0,0,0,.3); border: 1px solid rgba(255,220,140,.2); }
.uc-grid::-webkit-scrollbar, .uc-detail::-webkit-scrollbar, .uc-rgrid::-webkit-scrollbar { display: none; }
.uc-grid.hero { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.uc-card { position: relative; aspect-ratio: 1; min-width: 44px; min-height: 44px; padding: 4px; border-radius: 10px; border: 3px solid var(--qc); background: radial-gradient(circle, rgba(255,230,160,.22), rgba(20,4,2,.75)); cursor: pointer; transition: transform .12s; box-shadow: 0 0 8px color-mix(in srgb, var(--qc) 50%, transparent); }
.uc-card:active, .uc-hcard:active { transform: scale(.94); }
.uc-card.sel, .uc-hcard.sel { outline: 3px solid var(--gold-hi); outline-offset: 1px; transform: scale(1.05); z-index: 1; }
.uc-cimg { width: 100%; height: 100%; object-fit: contain; }
.uc-card.miss .uc-cimg { filter: grayscale(1) brightness(.45); }
.uc-card.miss { box-shadow: none; }
.uc-q { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 26px; color: #d8c8a0; text-shadow: var(--outline); }
.uc-lvtag { position: absolute; right: 2px; bottom: 2px; font-size: 12px; padding: 0 5px; border-radius: 7px; background: rgba(0,0,0,.75); color: var(--gold-hi); border: 1px solid var(--gold); }
.uc-hcard { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 2px; min-height: 44px; border-radius: 10px; border: 2px solid var(--qc); background: linear-gradient(rgba(60,12,8,.8), rgba(20,4,2,.85)); color: var(--cream); font-family: var(--font); font-weight: 900; cursor: pointer; transition: transform .12s; }
.uc-thumb { position: relative; width: 100%; height: 72px; }
.uc-himg { width: 100%; height: 100%; object-fit: contain; }
.uc-rar { position: absolute; left: 0; top: 0; font-size: 12px; padding: 0 5px; border-radius: 6px; color: #fff; text-shadow: var(--outline); }
.uc-maxtag { position: absolute; right: 0; top: 0; font-size: 12px; padding: 0 5px; border-radius: 6px; background: linear-gradient(var(--gold-hi), var(--gold-dark)); color: #3a1204; border: 1px solid #fff0b0; }
.uc-maxtag.inl { position: static; }
.uc-dot { position: absolute; right: 0; bottom: 2px; width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ff7a6a, #c8180e); border: 2px solid var(--gold-hi); box-shadow: 0 0 6px #ff4a3a; }
.uc-hname { font-size: 14px; text-shadow: var(--outline); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.uc-hline { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--gold-hi); white-space: nowrap; }
.uc-lvtag2 { padding: 0 5px; border-radius: 7px; background: rgba(0,0,0,.6); border: 1px solid var(--gold-dark); }
.uc-pips { display: flex; gap: 4px; } .uc-pips i { width: 10px; height: 10px; border-radius: 50%; background: rgba(0,0,0,.6); border: 1px solid var(--gold-dark); }
.uc-pips i.on { background: radial-gradient(circle at 35% 30%, #fff6c8, var(--gold) 50%, #a86a10); box-shadow: 0 0 5px #ffb52e; }
.uc-detail { flex: 1 1 48%; min-width: 0; display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 10px; background: linear-gradient(rgba(118,50,42,.55), rgba(66,28,24,.6)); border: 2px solid var(--gold-dark); overflow: hidden auto; scrollbar-width: none; max-height: min(52vh, 420px); text-align: left; }
.uc-dtop { display: flex; gap: 10px; align-items: center; }
.uc-dframe { flex: none; width: 84px; height: 84px; border-radius: 12px; border: 3px solid var(--qc); display: flex; align-items: center; justify-content: center; background: radial-gradient(circle, rgba(255,230,160,.25), rgba(20,4,2,.75)); box-shadow: 0 0 12px var(--qc); }
.uc-dframe.hero { width: 96px; height: 110px; }
.uc-dimg { width: 90%; height: 90%; object-fit: contain; }
.uc-dtx { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.uc-dname { font-size: 20px; line-height: 1.1; }
.uc-dtitle { font-size: 13px; color: #e9d3a8; }
.uc-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 14px; }
.uc-qtag { font-size: 12px; font-weight: 900; padding: 0 8px; border-radius: 8px; background: rgba(0,0,0,.55); border: 1px solid var(--qc); color: var(--qc); width: fit-content; }
.uc-desc { font-size: 13px; font-weight: 700; line-height: 1.3; color: #fbe9c4; text-shadow: 0 1px 0 #2a0805; word-break: keep-all; overflow-wrap: anywhere; line-break: strict; }
.uc-lvl { font-size: 16px; color: var(--gold-hi); }
.uc-stats { display: flex; flex-direction: column; gap: 2px; }
.uc-srow { font-size: 14px; color: #fff; text-shadow: var(--outline); }
.uc-srow.nx { color: #8ff0b0; }
.uc-sec { display: flex; flex-direction: column; gap: 4px; padding: 6px; border-radius: 8px; background: rgba(0,0,0,.28); }
.uc-sname { font-size: 15px; color: var(--gold-hi); }
.uc-fx { padding: 4px 6px; border-radius: 8px; border: 1px solid var(--gold); background: rgba(0,0,0,.35); }
.uc-fx.locked { opacity: .7; border-style: dashed; }
.uc-fxname { font-size: 14px; color: var(--gold-hi); text-shadow: var(--outline); }
.uc-actrow { display: flex; justify-content: flex-end; gap: 8px; margin-top: auto; }
.uc-act { min-width: 120px; min-height: 44px; padding: 0 8px; font-size: 15px; gap: 8px; }
.uc-act .sc-blabel { font-size: 15px; white-space: nowrap; }
.lq-btn.disabled.uc-act { filter: grayscale(.7) brightness(.7); }
.uc-cost { display: inline-flex; align-items: center; gap: 3px; font-size: 14px; padding: 0 6px; border-radius: 10px; background: rgba(0,0,0,.45); color: #fff; text-shadow: var(--outline); white-space: nowrap; }
.uc-cost.short { color: #ff8a70; }
.uc-exch { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: space-between; padding: 4px 6px; border-radius: 8px; background: rgba(0,0,0,.28); }
.uc-exl { font-size: 14px; color: var(--gold-hi); }
.uc-drawrow { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; flex-wrap: wrap; }
.uc-drawbtns { display: flex; align-items: center; gap: 8px; }
.uc-bagicon { width: 40px; height: 40px; object-fit: contain; }
.uc-draw { min-height: 44px; min-width: 110px; padding: 0 6px; gap: 6px; }
.uc-draw .sc-blabel { font-size: 15px; white-space: nowrap; }
.uc-drawrow .uc-note { flex: 1 1 200px; text-align: left; max-width: 420px; }
/* draw results */
.uc-rgrid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; width: min(100%, 800px); justify-items: stretch; }
.uc-rgrid:not(.many) { display: flex; flex-wrap: wrap; justify-content: center; }
.uc-rgrid:not(.many) .uc-rcard { width: 140px; }
.uc-rcard { width: 100%; box-sizing: border-box; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 3px; border-radius: 10px; border: 2px solid var(--qc); background: linear-gradient(rgba(70,14,8,.85), rgba(24,5,3,.9)); animation: uc-flip .45s cubic-bezier(.3,1.5,.5,1) both; }
.uc-rcard.new { box-shadow: 0 0 16px var(--gold), inset 0 0 10px rgba(255,210,100,.4); }
@keyframes uc-flip { 0% { transform: rotateY(90deg) scale(.5); opacity: 0; } 100% { transform: none; opacity: 1; } }
.uc-rframe { width: 72px; height: 72px; border-radius: 10px; border: 2px solid var(--qc); display: flex; align-items: center; justify-content: center; background: radial-gradient(circle, rgba(255,230,160,.25), rgba(20,4,2,.7)); box-shadow: 0 0 8px var(--qc); }
.uc-rimg { width: 90%; height: 90%; object-fit: contain; }
.uc-rname { font-size: 14px; text-align: center; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uc-rinfo { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--gold-hi); min-height: 20px; text-shadow: var(--outline); }
.uc-ribbon { padding: 0 10px; border-radius: 8px; background: linear-gradient(var(--gold-hi), var(--gold-dark)); color: #3a1204; text-shadow: none; font-size: 13px; animation: uc-glow 1s ease-in-out infinite alternate; }
@keyframes uc-glow { from { box-shadow: 0 0 4px #ffb52e; } to { box-shadow: 0 0 14px #ffe08a; } }
.uc-ok { min-width: 160px; min-height: 48px; font-size: 20px; }

/* ===== layout fix: codex + training fill a fixed-height panel; lists and detail scroll inside ===== */
.uc-codex .sc-panel, .uc-train .sc-panel { box-sizing: border-box; height: min(94vh, calc(640px*var(--m))); max-height: 94vh; overflow: hidden; }
.uc-codex .sc-head, .uc-train .sc-head { flex: none; flex-wrap: nowrap; }
.uc-codex .sc-head .sc-title, .uc-train .sc-head .sc-title { min-width: 0; white-space: nowrap; }
.uc-codex .uc-bonus, .uc-train .uc-drawrow, .uc-codex .uc-drawrow { flex: none; }
.uc-body { flex: 1 1 0; min-height: 0; align-items: stretch; }
.uc-grid, .uc-detail { box-sizing: border-box; max-height: none; height: 100%; min-height: 0; overflow-x: hidden; overflow-y: auto; touch-action: pan-y; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.uc-grid { grid-auto-rows: max-content; }
.uc-grid.hero { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
.uc-hcard { flex: none; height: auto; box-sizing: border-box; }
.uc-hcard > * { flex: none; }
.uc-detail > * { flex: none; }
.uc-detail::after { content: ""; flex: none; height: 2px; }
.uc-sec { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 6px; align-items: center; }
.uc-sec > * { grid-column: 1 / -1; min-width: 0; }
.uc-sec > .uc-sname { grid-column: 1; grid-row: 1; }
.uc-sec > .uc-actrow { grid-column: 2; grid-row: 1; margin: 0; }
.uc-sname { overflow-wrap: anywhere; line-height: 1.2; }
/* 一鍵升級技能／一鍵突破: both buttons on their own row at the bottom of the section */
.uc-sec > .uc-actrow.two { grid-column: 1 / -1; grid-row: auto; flex-wrap: wrap; justify-content: flex-end; }
.uc-act.uc-all { color: #fff8dc; text-shadow: var(--outline); }
.uc-allsum .sc-panel { min-width: min(420px, 90vw); align-items: center; gap: 10px; padding: 14px 18px; }
.uc-allrow { display: flex; align-items: center; gap: 14px; }
.uc-allimg { width: 84px; height: 84px; object-fit: contain; }
.uc-alltx { display: flex; flex-direction: column; gap: 6px; font-size: 16px; color: #fff; }
.uc-allname { font-size: 20px; color: var(--gold-hi, #ffe08a); }
@media (max-height: 520px) { .uc-allimg { width: 56px; height: 56px; } .uc-alltx { font-size: 14px; } }
.uc-chip { max-width: 100%; box-sizing: border-box; }
.uc-exch .uc-act { min-width: 0; }
.uc-exch .uc-exl { flex: 1 1 100px; min-width: 0; }
.uc-drawrow .uc-note { flex: 1 1 160px; }
.uc-draw .uc-cost { flex: none; }
@media (min-width: 900px) and (min-height: 600px) {
  .uc-hname { font-size: 15px; } .uc-hline { font-size: 13px; } .uc-desc { font-size: 15px; } .uc-note { font-size: 13px; }
  .uc-thumb { height: 84px; }
  .uc-grid:not(.hero) { grid-template-columns: repeat(auto-fill, minmax(calc(96px*var(--m)), 1fr)); }
  .uc-srow { font-size: 16px; } .uc-lvl { font-size: 18px; } .uc-dname { font-size: 22px; }
  .uc-dframe:not(.hero) { width: 104px; height: 104px; }
}
@media (max-height: 520px) {
  .uc-codex .sc-panel, .uc-train .sc-panel { gap: 3px; padding: 2px 6px 4px; width: 98vw; height: 95vh; max-height: 95vh; border-width: 7px; }
  .uc-codex .sc-title, .uc-train .sc-title, .uc-drawres .sc-title { font-size: 18px; padding: 2px 30px 6px; }
  .uc-drawres .sc-panel { gap: 4px; padding-bottom: 6px; }
  .uc-rgrid { gap: 5px; }
  .uc-rcard { padding: 3px 2px; gap: 1px; }
  .uc-rframe { width: 44px; height: 44px; }
  .uc-rname, .uc-rinfo { font-size: 12px; }
  .uc-ok { min-height: 44px; font-size: 17px; }
  .uc-hstat { min-height: 32px; font-size: 14px; padding: 0 8px; }
  .uc-body { gap: 6px; }
  .uc-grid { flex: 0 0 40%; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 3px; padding: 3px; }
  .uc-grid.hero { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); }
  .uc-detail { flex: 1 1 0; padding: 5px; gap: 4px; }
  .uc-thumb { height: 44px; }
  .uc-hcard { padding: 3px 2px; gap: 1px; }
  .uc-hname { font-size: 13px; }
  .uc-dframe { width: 52px; height: 52px; } .uc-dframe.hero { width: 52px; height: 64px; }
  .uc-dtop { gap: 8px; }
  .uc-dname { font-size: 16px; }
  .uc-dtitle, .uc-desc, .uc-srow { font-size: 12px; }
  .uc-sname { font-size: 13px; }
  .uc-fxname { font-size: 12px; }
  .uc-chip { font-size: 12px; padding: 0 6px; }
  .uc-sec { padding: 4px; }
  .uc-act { min-width: 88px; min-height: 44px; padding: 0 4px; gap: 4px; }
  .uc-act .sc-blabel { font-size: 13px; }
  .uc-cost { font-size: 13px; padding: 0 4px; }
  .uc-bonus { flex-direction: row; justify-content: center; flex-wrap: wrap; gap: 6px; }
  .uc-bonus .uc-note { display: none; }
  .uc-bagicon { width: 32px; height: 32px; }
  .uc-drawrow { flex-wrap: nowrap; gap: 6px; }
  .uc-draw { min-width: 96px; padding: 0 4px; }
  .uc-draw .sc-blabel { font-size: 13px; }
  .uc-drawrow .uc-note { font-size: 12px; line-height: 1.15; flex: 1 1 0; max-width: none; }
  .uc-odds { gap: 3px 4px; flex: none; }
  .uc-oddchip, .uc-oddl { font-size: 12px; padding: 0 5px; }
  .uc-filter { gap: 4px; }
  .uc-fchip { min-height: 44px; min-width: 44px; font-size: 13px; padding: 0 8px; }
  .uc-legbanner { font-size: 22px; }
}

/* ===== odds chips, quality filter, legendary effects ===== */
.uc-odds { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 6px; width: 100%; flex: none; }
.uc-oddl { font-size: 13px; font-weight: 900; color: var(--gold-hi); text-shadow: var(--outline); }
.uc-oddchip { font-size: 13px; font-weight: 900; padding: 0 8px; border-radius: 10px; background: rgba(0,0,0,.55); border: 1px solid var(--qc); color: var(--qc); text-shadow: 0 1px 0 #200; white-space: nowrap; }
.uc-oddchip.lg { animation: uc-redpulse 1.6s ease-in-out infinite alternate; border-width: 2px; }
.uc-filter { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; width: 100%; flex: none; }
.uc-fchip { min-height: 44px; min-width: 52px; padding: 0 12px; font-size: 14px; border-radius: 22px; --qc: var(--gold); border: 2px solid var(--qc); color: var(--qc); background: rgba(0,0,0,.5); font-family: var(--font); font-weight: 900; cursor: pointer; white-space: nowrap; text-shadow: var(--outline); }
.uc-fchip.primary { background: linear-gradient(var(--gold-hi), var(--gold-dark)); color: #3a1204; text-shadow: none; }
.uc-fchip .sc-blabel { font-size: inherit; white-space: nowrap; }
@keyframes uc-redpulse { from { box-shadow: 0 0 4px #ff3b30, inset 0 0 3px rgba(255,59,48,.4); } to { box-shadow: 0 0 16px #ff3b30, 0 0 26px rgba(255,59,48,.5), inset 0 0 8px rgba(255,59,48,.6); } }
.uc-card.lg, .uc-dframe.lg { border-color: #ff3b30; animation: uc-redpulse 1.8s ease-in-out infinite alternate; }
.uc-card.lg.miss { box-shadow: none; animation: none; }
.uc-rcard.lg { border-color: #ff3b30; border-width: 3px; background: linear-gradient(rgba(150,40,32,.92), rgba(80,26,22,.95)); animation: uc-flip .45s cubic-bezier(.3,1.5,.5,1) both, uc-redpulse 1.2s ease-in-out .5s infinite alternate; }
.uc-rcard.lg .uc-rframe { border-color: #ff3b30; box-shadow: 0 0 18px #ff3b30; }
.uc-legbanner { font-size: 30px; line-height: 1.1; text-align: center; white-space: nowrap; color: #ff4a3a; -webkit-text-stroke: 3px #3a0503; paint-order: stroke fill; text-shadow: 0 0 14px #ff3b30, 0 3px 0 #3a0503, 0 0 24px #ffb52e; animation: uc-slam .55s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes uc-slam { 0% { transform: scale(3); opacity: 0; } 70% { transform: scale(.94); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
.uc-redflash { position: absolute; inset: 0; pointer-events: none; z-index: 20; background: radial-gradient(circle at 50% 45%, rgba(255,59,48,.85), rgba(255,59,48,.35) 45%, rgba(255,59,48,0) 75%); animation: uc-flash .65s ease-out forwards; }
@keyframes uc-flash { from { opacity: 1; } to { opacity: 0; } }

/* ===== line-break fixes for the title / lobby / prep screens (this file loads last, so it wins ties) ===== */
/* labels never wrap */
.sc-prompt, .sc-start, .sc-start .sc-blabel, .sc-corner .sc-blabel, .sc-menubtn .sc-blabel, .sc-chipbtn .sc-blabel, .sc-mini .sc-blabel, .sc-mini2 .sc-blabel,
.sc-chipbar, .sc-count, .sc-lvl, .sc-title, .sc-bigtitle, .sc-cont, .sc-colname, .sc-node-name, .sc-dname, .sc-lootname, .sc-helpt { white-space: nowrap; }
.sc-prompt { max-width: 96%; overflow: hidden; text-overflow: ellipsis; }
/* paragraphs wrap at natural CJK points, no lone trailing character */
.sc-helpd, .sc-ddesc, .sc-dstats, .sc-lootdesc, .sc-node-desc, .sc-note, .sc-relic-desc, .sc-bhint, .sc-toast, .sc-waithost, .sc-subtitle, .sc-revmsg, .sc-unlock, .sc-optcol,
.pp-skill .pp-soft, .pp-item .it .pp-soft, .pp-empty, .pp-tip p, .pp-bchip .bn, .pp-pick { word-break: keep-all; overflow-wrap: anywhere; line-break: strict; text-wrap: pretty; }
.sc-bhint, .sc-toast, .sc-subtitle, .sc-ddesc, .sc-lootdesc, .sc-note { text-wrap: balance; }
.sc-panel, .sc-lobby-panel, .sc-over .sc-panel, .sc-end .sc-panel { touch-action: pan-y; }
.sc-armright, .sc-helplist, .sc-rewards { touch-action: pan-y; }
/* the lobby's own layout lives in style-lobby.css (loaded last) */
