/* Byakuya Gift Control — 白夜テーマ（紺・ラベンダー・銀・金） */
:root {
  --night: #0b0f2e; --night2: #161a4a; --violet: #3d3486; --lav: #b9a8ff; --lav2: #d8d0ff;
  --silver: #d9dcef; --gold: #ffd75e; --text: #eef0ff; --muted: #9a9cc4; --line: rgba(217, 220, 239, .14);
  --card: rgba(22, 26, 74, .72); --ok: #5ee0a0; --warn: #ffcc66; --ng: #ff7a8a;
  --radius: 18px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { background: #0b0f2e; }
body {
  color: var(--text); font: 15px/1.6 "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  background: radial-gradient(1200px 700px at 70% -10%, #2c2670 0%, rgba(44,38,112,0) 60%),
              linear-gradient(180deg, #0b0f2e 0%, #121547 55%, #1d1a55 100%) fixed;
  -webkit-font-smoothing: antialiased;
}
body::before { /* 白夜の地平線 */
  content: ""; position: fixed; left: 0; right: 0; bottom: 0; height: 220px; pointer-events: none; z-index: -1;
  background: radial-gradient(ellipse 60% 100% at 55% 100%, rgba(255,255,255,.14), rgba(255,255,255,0));
}
a { color: var(--lav2); }
button, input, select { font: inherit; color: var(--text); }
input, select {
  background: rgba(11, 15, 46, .7); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; width: 100%;
}
input:focus, select:focus { outline: 2px solid var(--lav); outline-offset: 0; }
input[type=checkbox] { width: 20px; height: 20px; accent-color: #9b86ff; padding: 0; }
input[type=range] { padding: 0; accent-color: #9b86ff; }
button {
  border: 1px solid var(--line); background: rgba(185,168,255,.12); border-radius: 12px; padding: 9px 14px; cursor: pointer;
  transition: background .15s, transform .1s;
}
button:hover { background: rgba(185,168,255,.22); }
button:active { transform: scale(.97); }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: linear-gradient(135deg, #cfc4ff, #8f7cf0); color: #120f3a; font-weight: 800; border: 0; }
button.gold { background: linear-gradient(135deg, #fff1b8, #f2c14e); color: #3a2a00; font-weight: 800; border: 0; }
button.danger { background: rgba(255,122,138,.14); color: #ffc1c9; }
button.small { padding: 5px 10px; font-size: 13px; border-radius: 9px; }

/* ===== レイアウト ===== */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { padding: 26px 18px; border-right: 1px solid var(--line); position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 10px; align-items: center; margin-bottom: 26px; }
.brand .logo { width: 40px; height: 40px; border-radius: 12px; }
.brand b { display: block; letter-spacing: .18em; font-size: 14px; color: var(--silver); }
.brand small { color: var(--muted); font-size: 11px; letter-spacing: .12em; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; text-decoration: none; color: var(--muted); }
.nav a .ic { width: 22px; text-align: center; }
.nav a.on { background: rgba(185,168,255,.16); color: #fff; box-shadow: inset 2px 0 0 var(--lav); }
.main { padding: 26px 30px 120px; max-width: 980px; width: 100%; min-width: 0; }
.top { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.top h1 { font-size: 22px; margin: 0; flex: 1; }
.pc-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 99px; background: rgba(11,15,46,.6); border: 1px solid var(--line); font-size: 13px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #666a8f; display: inline-block; }
.dot.ok { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.dot.warn { background: var(--warn); } .dot.ng { background: var(--ng); }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px;
  box-shadow: 0 10px 30px rgba(5, 4, 25, .35);
}
.card h2 { font-size: 16px; margin: 0 0 12px; color: var(--lav2); display: flex; align-items: center; gap: 8px; justify-content: space-between; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; }
.field label, label.field { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.check { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.muted { color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.big { font-size: 28px; font-weight: 800; }
.stat { background: rgba(11,15,46,.5); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.stat small { color: var(--muted); display: block; font-size: 12px; }
.stat b { font-size: 18px; }
.empty { text-align: center; color: var(--muted); padding: 26px 10px; }

/* ギフトルール */
.rule { background: rgba(11,15,46,.55); border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin-bottom: 12px; }
.rule.off { opacity: .55; }
.rule-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.gimg { width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; font-size: 24px;
  background: radial-gradient(circle, rgba(255,255,255,.9), rgba(200,190,255,.35) 55%, rgba(0,0,0,0) 72%); }
.gimg img { width: 38px; height: 38px; object-fit: contain; }
.rule-title { flex: 1; min-width: 0; }
.rule-title b { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rule-title small { color: var(--muted); }
.rule .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }

/* ギフトを選ぶ */
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.pick { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px 8px; border-radius: 14px;
  background: rgba(11,15,46,.55); border: 1px solid var(--line); min-height: 128px; }
.pick:hover { background: rgba(185,168,255,.16); }
.pick.on { border-color: var(--lav); background: rgba(185,168,255,.14); }
.pick-img { width: 64px; height: 64px; display: grid; place-items: center; font-size: 36px;
  background: radial-gradient(circle, rgba(255,255,255,.85), rgba(200,190,255,.25) 60%, rgba(0,0,0,0) 72%); border-radius: 50%; }
.pick-img img { width: 56px; height: 56px; object-fit: contain; }
.pick-name { font-size: 12px; line-height: 1.25; text-align: center; max-width: 100%; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pick-coin { font-size: 11px; color: var(--gold); }
.pick-check { position: absolute; top: 6px; right: 8px; color: var(--lav); font-weight: 800; }
@media (max-width: 820px) { .pick-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; } }

/* 受信ギフト・サウンド一覧 */
.list { display: flex; flex-direction: column; gap: 8px; }
.item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: rgba(11,15,46,.5); border: 1px solid var(--line); }
.item .t { flex: 1; min-width: 0; }
.item .t b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .t small { color: var(--muted); }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: rgba(255,215,94,.15); color: var(--gold); }

/* 保存バー */
.savebar { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%) translateY(150%); transition: transform .25s;
  display: flex; gap: 10px; align-items: center; padding: 10px 12px 10px 18px; border-radius: 99px; z-index: 30; white-space: nowrap;
  background: rgba(22,26,74,.96); border: 1px solid rgba(217,220,239,.3); box-shadow: 0 10px 30px rgba(0,0,0,.45); }
.savebar { visibility: hidden; pointer-events: none; }
.savebar.show { transform: translateX(-50%) translateY(0); visibility: visible; pointer-events: auto; }
@media (min-width: 821px) { .savebar { bottom: 24px; margin-left: 120px; } }

.toast { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 50; padding: 10px 16px; border-radius: 12px;
  background: rgba(22,26,74,.97); border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(0,0,0,.4); display: none; max-width: 92vw; }
.toast.show { display: block; }
.toast.err { border-color: var(--ng); color: #ffd1d7; }

/* ログイン */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .card { width: 100%; max-width: 400px; padding: 30px 26px; }
.login h1 { text-align: center; margin: 10px 0 4px; letter-spacing: .14em; font-size: 20px; }
.login .sub { text-align: center; color: var(--muted); font-size: 12px; letter-spacing: .2em; margin-bottom: 20px; }
.login .logo { display: block; margin: 0 auto; width: 64px; height: 64px; border-radius: 18px; }
.login form > * { margin-bottom: 12px; }

/* ===== バナーのプレビュー（PCアプリの /banner と同じ見た目） ===== */
.pv-wrap { position: relative; max-width: 100%; overflow: hidden; border-radius: 14px; background: linear-gradient(180deg, #5b6378, #2d3140); padding: 14px 0; }
.pv-scale { position: absolute; left: 0; top: 14px; width: 920px; transform-origin: 0 0; }
.pv .frame { padding: 4px; border-radius: 34px; background: linear-gradient(120deg, #f4f6ff 0%, #a9b0cf 22%, #ffffff 45%, #8d93b8 70%, #e9ecff 100%); }
.pv .cardb { position: relative; overflow: hidden; border-radius: 30px; height: 196px; background: linear-gradient(105deg, #0b0f2e 0%, #1b1d55 38%, #3d3486 70%, #7b67c4 100%); }
.pv .horizon { position: absolute; left: 0; right: 0; bottom: 0; height: 120px; background: radial-gradient(ellipse 70% 100% at 58% 100%, rgba(255,255,255,.30), rgba(214,205,255,.10) 50%, rgba(214,205,255,0)); }
.pv .moon { position: absolute; right: 26px; top: 18px; width: 34px; height: 34px; border-radius: 50%; box-shadow: -8px 6px 0 0 #f6f1d8; opacity: .85; }
.pv .rowb { position: absolute; inset: 0; display: flex; align-items: center; padding: 0 30px 0 24px; }
.pv .avatar { position: relative; width: 148px; height: 148px; flex-shrink: 0; }
.pv .ring { position: absolute; inset: -6px; border-radius: 50%; background: linear-gradient(140deg, #fff, #cfc4ff 35%, #7d6ae0 65%, #f6e7a8); box-shadow: 0 0 18px rgba(196,180,255,.85); }
.pv .inner { position: absolute; inset: 0; border-radius: 50%; overflow: hidden; border: 4px solid #0d1033; background: linear-gradient(140deg, #6f5bd6, #2b2c78); display: grid; place-items: center; font-size: 64px; font-weight: 800; }
.pv .info { flex: 1; min-width: 0; padding: 0 18px 0 26px; }
.pv .label { display: inline-block; font-size: 17px; font-weight: 800; letter-spacing: .28em; color: #1a1650; background: linear-gradient(90deg, #f7f3ff, #cfd4ee); border-radius: 99px; padding: 3px 14px 3px 16px; margin-bottom: 8px; }
.pv .name { font-size: 48px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 2px 0 rgba(10,8,40,.9), 0 0 12px rgba(160,140,255,.6); line-height: 1.15; }
.pv .msg { font-size: 26px; font-weight: 700; color: #d8d0ff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 6px; }
.pv .msg span { color: #fff4c8; }
.pv .gift { width: 132px; height: 132px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; font-size: 76px; background: radial-gradient(circle at 50% 45%, rgba(255,255,255,.95), rgba(226,218,255,.55) 45%, rgba(120,100,220,0) 72%); }
.pv .count { min-width: 150px; padding-left: 10px; font-family: "Arial Black", "Segoe UI Black", sans-serif; font-weight: 900; font-size: 84px; line-height: 1; color: #ffd75e; text-shadow: 0 3px 0 #8a5a00, 0 0 14px rgba(255,210,90,.65); }
.pv .count small { font-size: 52px; }

/* ===== スマホ ===== */
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; bottom: 0; left: 0; right: 0; top: auto; height: auto; padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    border-right: 0; border-top: 1px solid var(--line); background: rgba(11,15,46,.96); z-index: 20; }
  .brand { display: none; }
  .nav { flex-direction: row; justify-content: space-around; gap: 0; }
  .nav a { flex-direction: column; gap: 0; padding: 6px 4px; font-size: 10.5px; flex: 1; text-align: center; }
  .nav a .ic { font-size: 19px; width: auto; }
  .nav a.on { box-shadow: none; }
  .nav a.desk { display: none; }
  .main { padding: 18px 14px 150px; }
  .top h1 { font-size: 19px; }
}
