/* FXクエストの経験値・レベル・称号帳・昇格の試験 (10-20・public/level_ui.js): 左上の細い帯・もらった時の演出・航海手帳の「レベル」と称号帳・試験の窓 */

/* 左上の細い帯 (日課とポイントの札の下・位置は level_ui.js の layout)。重なりは左上の札と同じ 2 */
.lvBand {
  position: fixed; left: 12px; top: 110px; z-index: 2;
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px 0 8px;
  background: rgba(22, 34, 58, 0.88); color: #fff; border: 1px solid #d4a72c; border-radius: 999px;
  font-size: 13px; cursor: pointer; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2); white-space: nowrap; max-width: calc(100% - 24px); overflow: hidden;
}
.lvBand:hover { filter: brightness(1.08); }
.lvBand:focus-visible { outline: 3px solid var(--accent, #2a6496); outline-offset: 2px; }
.lvBandLv { color: #ffe39a; font-size: 14px; }
.lvBandRank { font-size: 12px; font-weight: bold; color: #1f1400; background: linear-gradient(135deg, #e6c25a, #f6e3a0); border-radius: 6px; padding: 0 5px; line-height: 1.5; }
.lvBandMeter { position: relative; display: inline-block; width: 64px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.22); overflow: hidden; flex: none; }
.lvBandFill { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, #e6b422, #ffe08a); border-radius: 3px; }
.lvBandNext { color: #dfe6f2; font-size: 12px; }
.lvBand.lvGlow { animation: lvGlow 1.6s ease-out; }
.lvBand.lvPop, .ptsPill.lvPop { animation: lvPop 0.5s ease-out; }
@keyframes lvGlow { 0% { box-shadow: 0 0 0 0 rgba(255, 214, 90, 0.9); } 40% { box-shadow: 0 0 0 10px rgba(255, 214, 90, 0.35); background: #7a5a10; } 100% { box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2); } }
@keyframes lvPop { 0% { transform: scale(1); } 35% { transform: scale(1.14); } 100% { transform: scale(1); } }

/* 演出の層 (押せない・遊びの窓 (8〜9)・船旅 (20) の上) */
.lvLayer { position: fixed; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }
.lvChip {
  position: fixed; padding: 3px 11px; border-radius: 10px; background: rgba(31, 36, 48, 0.9); color: #ffe39a; font-weight: bold; font-size: 16px;
  white-space: nowrap; max-width: 70vw; overflow: hidden; text-overflow: ellipsis; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.lvChip.corner { right: 12px; top: 8px; left: auto; }
.lvChip.move { animation: lvChipUp 2.6s ease-out both; }   /* (10-27: 少しゆっくり・少し大きめ) */
@keyframes lvChipUp { 0% { opacity: 0; transform: translateY(6px); } 15% { opacity: 1; transform: translateY(0); } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px); } }
.lvCoin {
  position: fixed; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff7c2 0 18%, #f2c63a 40%, #c08a1a 100%); border: 1px solid #8a6212; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.lvBig {
  position: fixed; left: 50%; top: 12%; transform: translateX(-50%); text-align: center; pointer-events: none;
  padding: 10px 22px; border-radius: 14px; background: rgba(22, 30, 48, 0.82); color: #fff; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35); max-width: calc(100% - 32px);
}
.lvBig:not(.still) { animation: lvBigIn 0.5s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes lvBigIn { 0% { opacity: 0; transform: translate(-50%, -12px) scale(0.8); } 100% { opacity: 1; transform: translate(-50%, 0) scale(1); } }
.lvBigMain { font-size: 30px; font-weight: bold; color: #ffd84a; text-shadow: 0 2px 0 #7a5208, 0 0 14px rgba(255, 200, 60, 0.6); line-height: 1.25; }
.lvBigSub { font-size: 15px; margin-top: 4px; color: #f2f2f2; }
.lvBig.up .lvBigMain { color: #bdf3ff; text-shadow: 0 2px 0 #1f4f6a, 0 0 12px rgba(120, 220, 255, 0.6); }
.lvBig.title .lvBigMain { font-size: 20px; color: #fff3c4; }
.lvBig.title.s { top: 8px; padding: 8px 16px; }
.lvStage.up .lvBigMain { color: #bdf3ff; text-shadow: 0 2px 0 #1f4f6a, 0 0 12px rgba(120, 220, 255, 0.6); font-size: 40px; }   /* レベルが上がった (10-27: 真ん中に) */
.lvStage.up .lvBigSub { font-size: 17px; }
.lvStage.up { background: rgba(10, 24, 40, 0.6); }
.lvStage.up .lvStageBox { padding: 22px 34px 14px; border-radius: 18px; background: rgba(22, 30, 48, 0.9); border: 3px solid #6cc8e8; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); }
.lvStage:not(.still).up .lvStageBox { animation: lvBigUp 0.6s cubic-bezier(.2, 1.3, .4, 1) both; }
@keyframes lvBigUp { 0% { transform: translateY(30px) scale(0.6); opacity: 0; } 100% { transform: none; opacity: 1; } }

/* 真ん中の舞台 (派手・節目・称号 ★3 以上・位)。押すと閉じる */
.lvStage { position: fixed; inset: 0; z-index: 45; display: grid; place-items: center; background: rgba(10, 14, 26, 0.55); padding: 16px; }
.lvStage:not(.still) { animation: lvFade 0.3s ease-out both; }
.lvStage.out { opacity: 0; transition: opacity 0.25s; }
.lvStage.t45 { background: rgba(4, 8, 20, 0.78); overflow: hidden; }
.lvStage.t3 { background: rgba(10, 24, 40, 0.6); }   /* (10-27: ★1〜3 も真ん中に・カードの演出と同じ濃さ) */
@keyframes lvFade { 0% { opacity: 0; } 100% { opacity: 1; } }
.lvStageBox { position: relative; z-index: 1; text-align: center; max-width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow-y: auto; color: #fff; }
.lvStage .btnRow { justify-content: center; margin-top: 12px; }
.lvStage .pbtn:not(.main) { color: #1f2430; }
.lvHint { font-size: 13px; color: #c9d2e2; margin: 8px 0 0; }
.lvBeam { position: absolute; left: 50%; top: 50%; width: 220vmax; height: 220vmax; margin: -110vmax 0 0 -110vmax; pointer-events: none;
  background: conic-gradient(from 0deg, rgba(255, 236, 150, 0.32) 0deg, transparent 18deg, transparent 180deg, rgba(255, 236, 150, 0.32) 180deg, transparent 198deg, transparent 360deg);
  animation: lvSpin 6s linear infinite; }
@keyframes lvSpin { to { transform: rotate(360deg); } }
.lvConf { position: absolute; top: -12px; width: 8px; height: 12px; border-radius: 2px; pointer-events: none; animation: lvConf linear both; }
@keyframes lvConf { 0% { transform: translateY(0) rotate(0); opacity: 1; } 100% { transform: translateY(110vh) rotate(720deg); opacity: 0.9; } }

/* 宝箱 (派手・節目のおまけ) */
.lvChest { position: relative; width: 120px; height: 92px; margin: 0 auto 8px; }
.lvChest.small { width: 80px; height: 62px; }
.lvChestBody { position: absolute; left: 0; right: 0; bottom: 0; height: 58%; border-radius: 6px; background: linear-gradient(#a8662a, #6e3c14); border: 3px solid #e2b23a; }
.lvChestLid { position: absolute; left: 0; right: 0; top: 4%; height: 44%; border-radius: 40px 40px 6px 6px; background: linear-gradient(#c27a34, #7c4518); border: 3px solid #e2b23a; transform-origin: 50% 100%; }
.lvChest.open .lvChestLid { animation: lvLid 0.7s 0.15s cubic-bezier(.3, 1.6, .5, 1) both; }
.lvChest.open::after { content: ''; position: absolute; left: 10%; right: 10%; top: 30%; height: 30%; border-radius: 50%; background: radial-gradient(#fff6b0, rgba(255, 210, 80, 0)); animation: lvFade 0.6s 0.4s both; }
@keyframes lvLid { 0% { transform: rotateX(0) translateY(0); } 100% { transform: rotateX(70deg) translateY(-22px); } }
.lvMsPts { font-size: 18px; font-weight: bold; color: #ffe39a; margin-bottom: 6px; }

/* 節目: 帆が上がる */
.lvSail { width: 90px; height: 100px; margin: 0 auto 6px; background: linear-gradient(135deg, #fffaf0, #e8dcc0); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.lvStage:not(.still) .lvSail { animation: lvSailUp 1s cubic-bezier(.2, 1.2, .4, 1) both; }
@keyframes lvSailUp { 0% { transform: translateY(60px) scaleY(0.2); opacity: 0; } 100% { transform: none; opacity: 1; } }
.lvCan { margin: 10px auto 0; padding: 10px 14px; text-align: left; background: #fffdf6; color: #1f2430; border: 2px solid #d4a72c; border-radius: 12px; }
.lvCan h3 { margin: 0 0 6px; font-size: 16px; }
.lvCan ul { margin: 0; padding-left: 20px; }
.lvCan li { margin: 2px 0; line-height: 1.5; }

/* 称号の札 (★3 = 銀・★4 = 金・★5 = 虹色の縁)。見せない称号は「？？？」がめくれる */
.lvTCard { width: min(360px, calc(100vw - 48px)); margin: 0 auto; perspective: 900px; }
.lvStage:not(.still) .lvTCard { animation: lvDrop 0.7s cubic-bezier(.2, 1.3, .4, 1) both; }
@keyframes lvDrop { 0% { transform: translateY(-60vh); } 100% { transform: none; } }
.lvTInner { position: relative; display: grid; transform-style: preserve-3d; }
.lvTFace { grid-area: 1 / 1; backface-visibility: hidden; border-radius: 14px; padding: 16px 14px; }
.lvTBack { display: none; place-items: center; font-size: 34px; font-weight: bold; color: #fff; background: #3a4560; border: 3px solid #9aa6c0; }
.lvTCard.flip .lvTBack { display: grid; }
.lvTCard.flip .lvTInner { animation: lvFlip 1.4s 0.6s ease-in-out both; }
.lvTCard.flip .lvTFront { transform: rotateY(180deg); }
@keyframes lvFlip { 0% { transform: rotateY(0); } 100% { transform: rotateY(180deg); } }
.lvTFront { background: #fffdf6; color: #1f2430; border: 3px solid #b8bec8; box-shadow: 0 0 0 4px rgba(200, 210, 230, 0.4); }
.lvTCard.s3 .lvTFront { border-color: #b8c4d4; box-shadow: 0 0 0 6px rgba(220, 230, 245, 0.5), 0 0 24px rgba(220, 230, 255, 0.7); }
.lvTCard.s4 .lvTFront { border-color: #d4a72c; background: linear-gradient(#fff9e0, #fff1c0); box-shadow: 0 0 0 6px rgba(240, 200, 80, 0.45), 0 0 30px rgba(255, 210, 90, 0.8); }
.lvTCard.s5 .lvTFront { border: 4px solid transparent; background: linear-gradient(#fffbea, #fff3cf) padding-box, linear-gradient(90deg, #ff7a7a, #ffd36b, #7fe08a, #6cc8ff, #c48bff) border-box; box-shadow: 0 0 34px rgba(255, 230, 140, 0.9); }
.lvTStars { color: #c9971f; font-size: 15px; letter-spacing: 2px; }
.lvTName { font-size: 26px; font-weight: bold; margin: 4px 0; }
.lvTLine { font-size: 15px; line-height: 1.6; color: #4a4030; }
.lvTSub { font-size: 13px; color: #5b6170; margin-top: 6px; }
.lvRankCard { width: min(360px, calc(100vw - 48px)); margin: 0 auto; padding: 16px; border-radius: 14px; background: linear-gradient(#1f3358, #142340); border: 3px solid #e2b23a; color: #fff; }
.lvStage:not(.still) .lvRankCard { animation: lvDrop 0.7s cubic-bezier(.2, 1.3, .4, 1) both; }
.lvRankCard .lvTSub { color: #d8e0f0; }
.lvRankIcon { width: 30px; height: 56px; margin: 0 auto 6px; background: linear-gradient(#fff 0 22%, #d23a2e 22% 44%, #fff 44% 66%, #d23a2e 66%); clip-path: polygon(30% 0, 70% 0, 100% 100%, 0 100%); }

/* 近くの人の難しい称号・位 */
.lvCheer { position: fixed; left: 50%; top: 8px; transform: translateX(-50%); z-index: 35; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center;
  padding: 6px 12px; border-radius: 12px; background: rgba(31, 36, 48, 0.92); color: #fff3c4; font-weight: bold; font-size: 14px; max-width: calc(100% - 24px); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3); }

.lvCheer .pbtn { color: #1f2430; font-size: 13px; padding: 2px 10px; min-height: 0; }
.lvExamCard .note { font-size: 13px; }

/* 航海手帳の「レベル」 */
.lvBookHead { padding: 10px 12px; border-radius: 12px; background: linear-gradient(135deg, #1f3358, #2b4a7a); color: #fff; margin-bottom: 8px; }
.lvBookLv { display: flex; align-items: center; gap: 8px; }
.lvBookLvN { font-size: 28px; font-weight: bold; color: #ffe39a; }
.lvBookMeter { position: relative; height: 10px; border-radius: 5px; background: rgba(255, 255, 255, 0.22); overflow: hidden; margin: 6px 0; }
.lvBookNext { margin: 0; font-size: 14px; color: #e8edf6; }
.lvBookStats { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; margin: 6px 0; }
.lvExams { display: grid; gap: 8px; }
.lvExam { border: 1px solid var(--line, #d8cfba); border-radius: 10px; padding: 8px 10px; background: #fff; }
.lvExam.passed { background: #fff6d8; border-color: #d4a72c; }
.lvExam.later { opacity: 0.6; }
.lvExam.running { border-color: var(--accent, #2a6496); box-shadow: 0 0 0 1px var(--accent, #2a6496) inset; }
.lvExamHead { display: flex; align-items: baseline; gap: 8px; }
.lvExamHead b { font-size: 16px; }
.lvExamLv { font-size: 13px; color: var(--sub, #5b6170); }
.lvExamWhat { margin: 4px 0; font-size: 14px; line-height: 1.5; }
.lvExamOk { margin: 4px 0 0; font-weight: bold; color: #8a6212; }
.lvExamNow { margin: 4px 0; font-size: 14px; line-height: 1.5; color: #1f3358; font-weight: bold; }
.lvMsList { display: grid; gap: 4px; }
.lvMsRow { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; padding: 4px 8px; border-radius: 8px; background: #fff; border: 1px solid var(--line, #e2dac6); font-size: 14px; }
.lvMsRow.done { background: #f4f9ee; }
.lvMsCan { color: var(--sub, #5b6170); font-size: 13px; }
.lvMsOk { color: #4b8a3f; font-weight: bold; font-size: 13px; }
.lvRecent { margin: 4px 0; padding-left: 20px; font-size: 14px; }

/* 称号帳 */
.lvTB { margin-bottom: 14px; }
.lvTBCount { font-size: 18px; font-weight: bold; margin: 4px 0; }
.lvCat { border: 1px solid var(--line, #d8cfba); border-radius: 10px; margin: 6px 0; background: #fff; }
.lvCat > summary { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; cursor: pointer; font-size: 15px; }
.lvCat.full > summary { background: #fff6d8; border-radius: 10px; }
.lvCatN { color: var(--sub, #5b6170); font-size: 14px; }
.lvTList { list-style: none; margin: 0; padding: 0 8px 8px; display: grid; gap: 6px; }
.lvT { border-radius: 8px; padding: 6px 8px; border: 1px solid #e6dfcc; background: #fbf8ef; }
.lvT.got { background: #fff; border-color: #c9bfa8; }
.lvT.got.s3 { border-color: #aeb8c8; box-shadow: 0 0 0 1px #d6dde8 inset; }
.lvT.got.s4 { border-color: #d4a72c; background: #fffaea; }
.lvT.got.s5 { border: 2px solid #e6b422; background: linear-gradient(#fffaea, #fff3cf); }
.lvT.not { opacity: 0.85; }
.lvT.hiddenN, .lvT.hint { color: var(--sub, #5b6170); font-size: 14px; background: #f4f1e8; }
.lvTTop { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.lvTWear { font-size: 12px; color: #fff; background: #2a6496; border-radius: 6px; padding: 0 6px; }
.lvTL { margin: 2px 0 0; font-size: 14px; color: #4a4030; line-height: 1.5; }
.lvTH { margin: 2px 0 0; font-size: 13px; color: var(--sub, #5b6170); line-height: 1.5; }
.lvTP { margin: 2px 0 0; font-size: 13px; font-weight: bold; color: #1f3358; }
.lvT .btnRow { margin-top: 4px; }
.lvT .pbtn { font-size: 13px; padding: 3px 10px; min-height: 0; }

/* 試験の窓 */
.lvExamDlg { position: fixed; inset: 0; z-index: 44; display: grid; place-items: center; background: rgba(10, 14, 26, 0.55); padding: 12px; }
.lvExamDlg.hidden { display: none; }
.lvExamCard { width: min(560px, 100%); max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); overflow-y: auto; background: var(--solid, #fffdf6); color: var(--ink, #1f2430); border: 2px solid #d4a72c; border-radius: 14px; padding: 12px 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); }
.lvExamTop { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 15px; }
.lvExamNo { color: var(--sub, #5b6170); }
.lvExamTime { position: relative; height: 6px; border-radius: 3px; background: #eee6d2; overflow: hidden; margin: 8px 0; }
.lvExamTimeFill { position: absolute; left: 0; top: 0; bottom: 0; background: #2a6496; transition: width 0.25s linear; }
.lvExamQ { font-size: 17px; line-height: 1.6; margin: 8px 0; font-weight: bold; }
.lvExamChoices { display: grid; gap: 6px; }
.lvExamChoices.ox { grid-template-columns: 1fr 1fr; }
.lvExamChoice { text-align: left; font-size: 15px; padding: 10px 12px; line-height: 1.5; }
.lvExamChoices.ox .lvExamChoice { text-align: center; font-size: 22px; }
.lvExamChoice.picked { outline: 3px solid #d4a72c; }
.lvExamTitle { margin: 4px 0 8px; font-size: 20px; }
.lvExamRes { font-size: 15px; line-height: 1.6; margin: 4px 0; }

/* スマホ (横向きの低い画面・縦の狭い画面) */
@media (max-width: 700px), (max-height: 430px) {
  .lvBand { height: 22px; font-size: 12px; gap: 4px; padding: 0 8px 0 6px; }
  .lvBandLv { font-size: 13px; }
  .lvBandMeter { width: 44px; }
  .lvBigMain { font-size: 22px; }
  .lvBigSub { font-size: 13px; }
  .lvTName { font-size: 20px; }
  .lvChest { width: 90px; height: 70px; }
  .lvSail { width: 60px; height: 66px; }
  .lvExamQ { font-size: 15px; }
  .lvExamChoice { padding: 7px 10px; font-size: 14px; }
}
/* 低い画面 (スマホの横): 節目の札・称号の札を 1 画面に収める (帆は出さない・宝箱は小さく・ボタンが見えるように) */
@media (max-height: 430px) {
  .lvStage { padding: 6px; }
  .lvStageBox { max-height: calc(100vh - 12px); max-height: calc(100dvh - 12px); }
  .lvStage.ms .lvSail { display: none; }
  .lvStage.ms .lvStageBox { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; align-items: center; max-width: min(640px, calc(100vw - 16px)); }
  .lvStage.ms .lvBigMain, .lvStage.ms .lvBigSub, .lvStage.ms .lvCan, .lvStage.ms .btnRow { grid-column: 1 / -1; }
  .lvStage.ms .lvChest.small { width: 48px; height: 36px; margin: 0; justify-self: end; }
  .lvStage.ms .lvMsPts { margin: 0; justify-self: start; font-size: 15px; }
  .lvCan { margin-top: 6px; padding: 6px 10px; }
  .lvCan h3 { font-size: 14px; margin-bottom: 2px; }
  .lvCan li { font-size: 13px; line-height: 1.4; }
  .lvStage .btnRow { margin-top: 6px; }
  .lvTFace { padding: 10px 12px; }
  .lvTName { font-size: 20px; }
  .lvTLine { font-size: 13px; }
  .lvChest { width: 72px; height: 56px; }
}
@media (prefers-reduced-motion: reduce) {
  .lvBeam, .lvConf { display: none; }
}
