/* Arcalink play.html - 秘宝 (relic) pick, placement step and the relic parts of the weapon panel (spec arcalink-builds.md ch.10-2 / 12).
   The card pick's frame language (bevelled octagon, 3-4 px metal frame, art in a pit on the left, name / text on the right) with a treasure look of its own:
   a prismatic frame (mana cyan -> dense-mana gold -> thunder violet, the three light colours of the game), a hexagon socket with slow rays for the picture,
   a night-teal face with fine facet lines. Motion: transform and opacity only. No pictures to load (the emblems are inline SVG: nothing shows half drawn). */
:root { --rl-a: #5ad7ff; --rl-b: #ffe9a8; --rl-c: #b79cff; --rl-face: #0c1d33; --rl-face2: #0a1426; }

body.inrelic #top, body.inrelic #dock, body.inrelic #build, body.inrelic #bkInfo, body.inrelic #relBtn { opacity: 0; }
#relic { top: 0; bottom: 0; z-index: 7; display: flex; flex-direction: column; padding: calc(env(safe-area-inset-top) + 12px) 12px calc(env(safe-area-inset-bottom) + 12px); gap: 10px; pointer-events: auto; overflow: hidden; transition: opacity .22s ease-out; }
#relic > .rbg { position: absolute; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(ellipse 90% 50% at 50% 22%, rgba(90,215,255,.2), transparent 70%), radial-gradient(ellipse 80% 40% at 50% 100%, rgba(255,233,168,.1), transparent 70%), rgba(5,8,19,.95); }
#relic.leave, #relic.leave * { pointer-events: none !important; }
#relic .rth { text-align: center; flex: none; }
#relic .rhd { display: flex; align-items: center; justify-content: center; gap: 10px; }
#relic h2 { margin: 0; font-size: 20px; letter-spacing: .1em; color: #fff7dc; text-shadow: 0 0 14px rgba(255,233,168,.45); }
#relic .rsub { margin: 3px 0 0; font-size: 12px; color: var(--ar-text-sub); line-height: 1.4; }
#relic .rsub b { color: var(--rl-b); font-weight: 800; }
#relic .rgm { width: 18px; height: 22px; flex: none; background: linear-gradient(135deg, #fff, var(--rl-a) 40%, #1c5f86); clip-path: polygon(50% 0, 100% 35%, 80% 100%, 20% 100%, 0 35%); animation: rgGlint 2.4s ease-in-out infinite; will-change: transform; }
@keyframes rgGlint { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.14); } }
#relic .rule i { background: var(--rl-b); }
#relic .rule::before { background: linear-gradient(90deg, transparent, rgba(255,233,168,.55), transparent); }
.rlst { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: center; gap: 10px; }   /* (one or two relics sit in the middle, not at the top) */

/* ---- one relic */
.rc { --b: 12px; --bi: 10px; --bw: 3px; will-change: transform, opacity; position: relative; flex: 1; min-height: 0; max-height: 196px; border: 0; padding: 0; display: flex; align-items: stretch; opacity: 0; transform: perspective(700px) rotateY(88deg); animation: flipin .6s cubic-bezier(.2,.8,.25,1) forwards; animation-delay: var(--d, 0s); text-align: left;
  background: linear-gradient(135deg, #fff6d0, var(--rl-a) 24%, #1c5f86 40%, var(--rl-b) 56%, var(--rl-c) 78%, #fff6d0);
  clip-path: polygon(var(--b) 0, calc(100% - var(--b)) 0, 100% var(--b), 100% calc(100% - var(--b)), calc(100% - var(--b)) 100%, var(--b) 100%, 0 calc(100% - var(--b)), 0 var(--b)); }
.rc .rface { position: absolute; inset: var(--bw); display: flex; overflow: hidden; background: repeating-linear-gradient(62deg, rgba(150,220,255,.05) 0 1px, transparent 1px 9px), linear-gradient(180deg, var(--rl-face), var(--rl-face2));
  box-shadow: inset 0 0 0 1px rgba(255,233,168,.55), inset 0 0 0 3px #07101d, inset 0 0 0 4px rgba(90,215,255,.5);
  clip-path: polygon(var(--bi) 0, calc(100% - var(--bi)) 0, 100% var(--bi), 100% calc(100% - var(--bi)), calc(100% - var(--bi)) 100%, var(--bi) 100%, 0 calc(100% - var(--bi)), 0 var(--bi)); }
.rc .rface::before { content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;   /* a small gem in each corner */
  background: linear-gradient(135deg, #fff, var(--rl-a)) 8px 8px / 7px 7px no-repeat, linear-gradient(135deg, #fff, var(--rl-a)) calc(100% - 8px) 8px / 7px 7px no-repeat, linear-gradient(135deg, #fff, var(--rl-a)) 8px calc(100% - 8px) / 7px 7px no-repeat, linear-gradient(135deg, #fff, var(--rl-a)) calc(100% - 8px) calc(100% - 8px) / 7px 7px no-repeat; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); }
.rc .rface::after { content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none; background: linear-gradient(105deg, rgba(220,240,255,0) 36%, rgba(220,240,255,.34) 50%, rgba(220,240,255,0) 64%); transform: translateX(-120%); animation: shine 1.2s ease-out forwards; animation-delay: calc(var(--d, 0s) + .55s); }
.rc .rart { width: 104px; flex: none; position: relative; display: flex; align-items: center; justify-content: center; border-right: 1px solid rgba(90,215,255,.3); background: radial-gradient(circle at 50% 50%, rgba(90,215,255,.22), transparent 66%); }
.rc .rart::before { content: ""; position: absolute; width: 116px; height: 116px; left: 50%; top: 50%; margin: -58px 0 0 -58px; background: repeating-conic-gradient(rgba(255,233,168,.28) 0 7.5deg, transparent 7.5deg 15deg); -webkit-mask-image: radial-gradient(circle, #000 20%, transparent 68%); mask-image: radial-gradient(circle, #000 20%, transparent 68%); animation: spin 48s linear infinite; will-change: transform; }
.rc .rsock { position: relative; width: 78px; height: 78px; display: flex; align-items: center; justify-content: center; background: linear-gradient(180deg, var(--rl-b), #8e6a30);
  clip-path: polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%); }
.rc .rsock::before { content: ""; position: absolute; inset: 3px; background: radial-gradient(circle at 50% 42%, #1c4a6e, #07101d 72%); clip-path: polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%); }
.rc .rli { position: relative; width: 58px; height: 58px; animation: rcFloat 3.2s ease-in-out infinite; will-change: transform; }
@keyframes rcFloat { 0%, 100% { transform: translateY(1px); } 50% { transform: translateY(-2px); } }
.rc .rtx { flex: 1; min-width: 0; padding: 10px 12px 8px 10px; display: flex; flex-direction: column; justify-content: center; gap: 3px; }
.rc .rk { font-size: 11px; font-weight: 800; letter-spacing: .14em; color: var(--rl-a); display: flex; align-items: center; gap: 6px; }
.rc .rk .wi { width: 20px; height: 20px; margin: 0; flex: none; }
.rc .rnm { font-size: 18px; font-weight: 900; color: #fffbe3; text-shadow: 0 1px 0 #7a5416, 0 0 8px rgba(255,220,120,.3); }
.rc .rds { font-size: 12px; line-height: 1.42; color: #dfe9f7; }
.rc .rfit { font-size: 11px; color: #9dffbe; opacity: .9; } .rc .rfit.none { color: var(--ar-text-sub); }
.rc .rfit .num { min-width: 0; }
.rc .rpick { position: absolute; inset: 0; background: transparent; border: 0; z-index: 6; cursor: pointer; }
/* the chosen relic: a thick bright frame + a glow inside, the others sink (the card's own flip animation holds transform / opacity, so only --bw, filter and the inside are used) */
.rc.sel { --bw: 7px; filter: brightness(1.12); background: linear-gradient(135deg, #fff, #fff6d0 30%, var(--rl-b) 52%, #fff 78%, var(--rl-b)); }
.rc.sel .rface { box-shadow: inset 0 0 0 1px #fff3c4, inset 0 0 30px rgba(255,233,168,.55), inset 0 0 0 3px #07101d; }
.rc.sel .rk::after { content: "選択中"; margin-left: auto; padding: 1px 8px; font-size: 10px; letter-spacing: .1em; color: #0a0c18; background: var(--rl-b); clip-path: polygon(4px 0, calc(100% - 4px) 0, 100% 4px, 100% calc(100% - 4px), calc(100% - 4px) 100%, 4px 100%, 0 calc(100% - 4px), 0 4px); }
#relic.picked .rc:not(.sel) { filter: brightness(.5) saturate(.5); }
.rc.taken { animation: rcTaken .38s ease-out forwards; z-index: 3; } @keyframes rcTaken { 0% { transform: scale(1.03); } 45% { transform: scale(1.09); filter: brightness(1.35); } 100% { transform: scale(1.04); filter: brightness(1.1); opacity: 1; } }
.rc.gone { animation: rcGone .3s ease-in forwards; } @keyframes rcGone { to { opacity: 0; transform: translateY(14px) scale(.96); } }
.rgo { flex: none; height: 52px; opacity: 0; pointer-events: none; transition: opacity 160ms; } .rgo.on { opacity: 1; pointer-events: auto; } .rgo .btn { width: 100%; }

/* ---- step 2: which weapon takes it (a small map of the field + the candidates) */
.rplc { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.rplc .rcur { display: flex; align-items: center; gap: 10px; flex: none; padding: 6px 10px; background: rgba(90,215,255,.08); box-shadow: inset 0 0 0 1px rgba(255,233,168,.4); clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px), 0 8px); }
.rplc .rcur .ri { width: 44px; height: 44px; flex: none; }
.rplc .rcur .t { min-width: 0; } .rplc .rcur .nm { font-weight: 900; font-size: 15px; color: #fffbe3; } .rplc .rcur .ds { font-size: 11px; color: var(--ar-text-sub); line-height: 1.35; }
.rplc .rbody { flex: 1; min-height: 0; display: flex; gap: 10px; container-type: size; }
.rmap { flex: none; --ar: .5625; width: min(46cqw, calc(100cqh * var(--ar))); height: min(100cqh, calc(46cqw / var(--ar))); position: relative; background: #0e1a14; box-shadow: inset 0 0 0 1px rgba(255,233,168,.45); clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px), 0 8px); }
.rmap svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.rmap .rd { fill: #6a5a3a; stroke: #1a140a; stroke-width: 1; } .rmap .rdl { fill: none; stroke: #c9a463; stroke-width: 14; stroke-linecap: round; stroke-linejoin: round; opacity: .85; } .rmap .rdb { fill: none; stroke: #1a140a; stroke-width: 22; stroke-linecap: round; stroke-linejoin: round; }
.rmap .tw { fill: #55627f; stroke: #0a0c18; stroke-width: 5; opacity: .75; } .rmap .tw.has { fill: #f0cf85; }
.rmap .cand { cursor: pointer; } .rmap .cand circle { fill: #3fd0ff; stroke: #0a0c18; stroke-width: 6; } .rmap .cand.on circle { fill: #ffe9a8; } .rmap .cand text { font: 800 40px var(--ar-num); fill: #0a0c18; text-anchor: middle; dominant-baseline: central; }
.rmap .cand circle.hit { fill: transparent; stroke: none; } .rmap .cand circle.selr { fill: none; stroke: #fff; stroke-width: 7; opacity: .9; }
.rmap .core { fill: #3fd0ff; stroke: #0a0c18; stroke-width: 5; }
.rlist { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.rrow { --fr: 8px; --bw: 1.5px; --fill: var(--ar-page-hi); --ring: color-mix(in srgb, var(--ar-brass) 40%, transparent); position: relative; isolation: isolate; background: var(--ring); border: 0; padding: 6px 8px; min-height: 52px; display: flex; align-items: center; gap: 8px; text-align: left; color: var(--ar-text);
  clip-path: polygon(var(--fr) 0, calc(100% - var(--fr)) 0, 100% var(--fr), 100% calc(100% - var(--fr)), calc(100% - var(--fr)) 100%, var(--fr) 100%, 0 calc(100% - var(--fr)), 0 var(--fr)); }
.rrow::before { content: ""; position: absolute; inset: var(--bw); z-index: -1; background: var(--fill); clip-path: polygon(7px 0, calc(100% - 7px) 0, 100% 7px, 100% calc(100% - 7px), calc(100% - 7px) 100%, 7px 100%, 0 calc(100% - 7px), 0 7px); }
.rrow.on { --ring: linear-gradient(180deg, var(--ar-brass-hi), var(--ar-brass)); --fill: #1d2c4c; }
.rrow .bn { width: 28px; height: 28px; flex: none; display: flex; align-items: center; justify-content: center; font: 800 15px var(--ar-num); color: #0a0c18; background: var(--rl-a); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.rrow.on .bn { background: var(--rl-b); }
.rrow .wic2 { width: 30px; height: 30px; flex: none; }
.rrow .t { min-width: 0; flex: 1; } .rrow .nm { font-weight: 800; font-size: 14px; } .rrow .ds { font-size: 11px; color: var(--ar-text-sub); }
.rleg { margin-top: 4px; padding: 8px 4px 0; border-top: 1px solid rgba(255,233,168,.25); font-size: 11px; color: var(--ar-text-sub); line-height: 1.5; } .rleg > div { display: flex; align-items: center; gap: 6px; } .rleg p { margin: 6px 0 0; color: #cfdcf0; }
.rleg .lg { width: 12px; height: 12px; flex: none; border-radius: 50%; border: 1.5px solid #0a0c18; } .rleg .lg.c { background: var(--rl-a); } .rleg .lg.g { background: #55627f; } .rleg .lg.k { background: #3fd0ff; border-radius: 0; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.rrow .num { min-width: 0; font-size: inherit; }
.rbtns { flex: none; display: flex; flex-direction: column; gap: 6px; }
.rbtns .btn { width: 100%; }

/* ---- the weapon panel: 秘宝 row, the cards working on this weapon, the relic sheet from the dock */
.rsec { margin: 8px 0 2px; }
.rslot { --fr: 8px; --bw: 1.5px; --fill: #0e1f36; --ring: linear-gradient(135deg, var(--rl-a), var(--rl-b), var(--rl-c)); position: relative; isolation: isolate; background: var(--ring); display: flex; align-items: center; gap: 8px; padding: 6px 8px; min-height: 56px; margin: 4px 0;
  clip-path: polygon(var(--fr) 0, calc(100% - var(--fr)) 0, 100% var(--fr), 100% calc(100% - var(--fr)), calc(100% - var(--fr)) 100%, var(--fr) 100%, 0 calc(100% - var(--fr)), 0 var(--fr)); }
.rslot::before { content: ""; position: absolute; inset: var(--bw); z-index: -1; background: var(--fill); clip-path: polygon(7px 0, calc(100% - 7px) 0, 100% 7px, 100% calc(100% - 7px), calc(100% - 7px) 100%, 7px 100%, 0 calc(100% - 7px), 0 7px); }
.rslot.empty { --ring: color-mix(in srgb, var(--ar-brass) 30%, var(--ar-ink)); --fill: var(--ar-pit); color: var(--ar-text-sub); font-size: 12px; }
.rslot .ri { width: 40px; height: 40px; flex: none; } .rslot .t { flex: 1; min-width: 0; } .rslot .nm { font-weight: 900; font-size: 14px; color: #fffbe3; } .rslot .ds { font-size: 11px; color: #cfdcf0; line-height: 1.35; }
.rslot .btn { flex: none; min-height: 40px; padding: 4px 10px; font-size: 13px; }
.rslot.bag { --fill: #101a30; } .rslot .st { font-size: 11px; color: var(--ar-text-sub); }
.mods { display: flex; flex-wrap: wrap; gap: 5px; margin: 4px 0; }
.mod { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 3px; min-height: 28px; font-size: 11px; font-weight: 700; color: var(--ar-text); background: rgba(233,184,74,.12); box-shadow: inset 0 0 0 1px rgba(233,184,74,.5); clip-path: polygon(5px 0, calc(100% - 5px) 0, 100% 5px, 100% calc(100% - 5px), calc(100% - 5px) 100%, 5px 100%, 0 calc(100% - 5px), 0 5px); }
.mod .mi { width: 22px; height: 22px; flex: none; } .mod.s { background: rgba(170,184,216,.12); box-shadow: inset 0 0 0 1px rgba(170,184,216,.5); } .mod.pr { box-shadow: inset 0 0 0 1px rgba(90,215,255,.7); background: rgba(90,215,255,.12); }
#relBagBtn { flex: 0 0 auto !important; min-width: 58px; padding: 4px 6px; gap: 4px; } #relBagBtn .ri { width: 28px; height: 28px; } #relBagBtn .num { font-size: 15px; min-width: 0; }
#relBagBtn.glow .ri { animation: rcFloat 1.4s ease-in-out infinite; }

/* short phones: 375x667, 360x560, 320x568 */
@media (max-height: 700px) {
  #relic { padding-top: calc(env(safe-area-inset-top) + 8px); gap: 7px; }
  #relic h2 { font-size: 18px; } #relic .rsub { font-size: 11px; margin-top: 1px; }
  .rlst { gap: 7px; } .rc .rart { width: 88px; } .rc .rsock { width: 64px; height: 64px; } .rc .rli { width: 46px; height: 46px; }
  .rc .rtx { padding: 6px 10px 6px 8px; gap: 2px; } .rc .rnm { font-size: 16px; } .rc .rds { font-size: 11.5px; line-height: 1.36; } .rc .rk { font-size: 10px; } .rc .rfit { font-size: 10.5px; }
  .rgo { height: 46px; } .rgo .btn { min-height: 44px; height: 46px; }
}
@media (max-height: 600px), (max-width: 359px) {
  #relic .rsub { display: none; }
  .rc .rart { width: 72px; } .rc .rart::before { width: 84px; height: 84px; margin: -42px 0 0 -42px; } .rc .rsock { width: 52px; height: 52px; } .rc .rli { width: 38px; height: 38px; }
  .rc .rnm { font-size: 15px; } .rc .rds { font-size: 11px; line-height: 1.32; } .rc .rtx { padding: 4px 8px 4px 6px; }
  /* (12-01 QA) the 「弓の塔 N基のうち、空きN基」 row stays at 320 x 568: the three cards leave room (it was already shown there with the curse plate) */
  .rplc .rcur .ds { display: none; } .rplc .rcur { padding: 4px 8px; } .rplc .rcur .ri { width: 36px; height: 36px; }
  .rrow { min-height: 46px; padding: 4px 6px; } .rrow .ds { display: none; }
}
@media (max-width: 359px) { .rc .rds { font-size: 10.5px; } .rc .rk .wi { display: none; } }
/* the card pick: the tag beside the name (e.g. 金 ・ 性質) takes less room on narrow screens (tracking) */
@media (max-width: 359px), (max-height: 620px) { #cards .cd .tr { letter-spacing: .06em; font-size: 10.5px; } #cards .cd .tr::before { margin-right: 4px; } }
