/* Vault Gate — ゲームのランチャーの見た目。暗い地に、金庫の扉の金色を差し色にする。
   左に柱（ロゴ・切り替え・自分のアカウント）、右に舞台（ライブラリのタイル）。せまい画面では、柱は上の帯になる。 */
:root {
  color-scheme: dark;
  --bg: #0b0e13; --panel: #131821; --panel-2: #1a212c; --panel-3: #232c3a; --line: #2a3443;
  --fg: #e9edf4; --muted: #8e99ab; --dim: #5d6879;
  --gold: #f2b441; --gold-ink: #1a1203; --red: #ff6b61; --green: #4fd28a;
  --side-top: #10141c; --side-bottom: #0c1016; --radius: 12px; --input-bg: #0d1118; --accent-rgb: 242, 180, 65;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
body {
  margin: 0; min-height: 100%; background: var(--bg); color: var(--fg); font-size: 16px; line-height: 1.5;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI", "Meiryo", "Noto Sans JP", sans-serif;
  background-image: radial-gradient(1200px 500px at 85% -10%, rgba(var(--accent-rgb), 0.09), transparent 60%), radial-gradient(900px 500px at -10% 110%, rgba(64, 120, 255, 0.08), transparent 60%);
  background-attachment: fixed;
}
h1, h2, h3, p { margin: 0; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; padding: 0; }
button:disabled { opacity: 0.4; cursor: default; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); font-size: 14px; }
.error { color: var(--red); font-size: 14px; font-weight: 600; }
.center { text-align: center; padding: 30vh 16px; }

/* ---- ロゴ（金庫の扉のダイヤル） */
.logo { display: flex; align-items: center; gap: 12px; }
.logo svg { width: 38px; height: 38px; flex: none; }
.logo .word { font-weight: 800; letter-spacing: 0.22em; font-size: 15px; line-height: 1.15; }
.logo .word b { display: block; color: var(--gold); font-weight: 800; }

/* ---- 柱と舞台 */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side {
  background: linear-gradient(180deg, var(--side-top), var(--side-bottom)); border-right: 1px solid var(--line); padding: 22px 14px 16px;
  display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh;
}
.nav { display: grid; gap: 4px; }
.nav-label { font-size: 11px; font-weight: 700; letter-spacing: 0.14em; color: var(--dim); padding: 10px 10px 4px; }
.nav button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 10px 12px; border-radius: 9px;
  color: var(--muted); font-weight: 600; font-size: 15px; border-left: 3px solid transparent;
}
.nav button:hover { background: var(--panel-2); color: var(--fg); }
.nav button[aria-current="page"] { background: var(--panel-2); color: var(--fg); border-left-color: var(--gold); }
.nav svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.who { margin-top: auto; display: grid; gap: 10px; border-top: 1px solid var(--line); padding-top: 14px; }
.who .me { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar {
  width: 38px; height: 38px; border-radius: 10px; flex: none; display: grid; place-items: center; font-weight: 800; font-size: 17px;
  background: linear-gradient(135deg, var(--gold), var(--gold)); color: var(--gold-ink); text-transform: uppercase;
}
.avatar.big { width: 72px; height: 72px; border-radius: 18px; font-size: 32px; }
.who .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who .role { font-size: 12px; color: var(--muted); }
.ghost { border: 1px solid var(--line); border-radius: 9px; padding: 8px 12px; font-size: 14px; font-weight: 600; color: var(--muted); text-align: center; }
.ghost:hover { color: var(--fg); border-color: var(--dim); background: var(--panel-2); }
.stage { padding: 28px clamp(16px, 3vw, 40px) 56px; min-width: 0; display: grid; gap: 26px; align-content: start; }
.stage > .head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.kicker { font-size: 11px; font-weight: 700; letter-spacing: 0.16em; color: var(--gold); }
h1 { font-size: clamp(24px, 3vw, 32px); font-weight: 800; line-height: 1.2; text-wrap: balance; }
h2 { font-size: 12px; font-weight: 700; letter-spacing: 0.14em; color: var(--muted); }
.status { min-height: 1.4em; color: var(--gold); font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }

/* ---- タイルの絵（アプリごとの色）。絵の代わりに、色の面と大きな頭文字で見分ける */
.art { position: relative; overflow: hidden; background: linear-gradient(135deg, var(--c1), var(--c2)); color: #fff; }
.art::before {   /* 斜めの光の帯 */
  content: ""; position: absolute; inset: -40% -20% auto auto; width: 70%; height: 180%; transform: rotate(24deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.14), transparent);
}
.art::after {    /* 下を暗くして、文字を読みやすく */
  content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 35%, rgba(5, 8, 12, 0.72));
}
.art .glyph {
  position: absolute; right: -4px; bottom: -22px; font-size: 150px; font-weight: 900; line-height: 1; opacity: 0.2; letter-spacing: -0.04em;
  text-transform: uppercase; user-select: none;
}
.art-amber { --c1: #f2a93b; --c2: #8a3c12; }
.art-cyan { --c1: #27c4d9; --c2: #0e4a7a; }
.art-violet { --c1: #9a6bff; --c2: #3a1e86; }
.art-green { --c1: #3fca7f; --c2: #0d5a48; }
.art-rose { --c1: #ff6f91; --c2: #8a1f4c; }
.art-blue { --c1: #4b8dff; --c2: #1a2f8c; }

/* ---- いちばん上の大きな帯（前に開いたもの） */
.hero { border-radius: 18px; min-height: 230px; display: grid; align-content: end; padding: clamp(18px, 3vw, 30px); border: 1px solid rgba(255, 255, 255, 0.08); }
.hero > * { position: relative; z-index: 1; }
.hero .glyph { font-size: 320px; bottom: -70px; right: 2%; z-index: 0; }
.hero .kicker { color: rgba(255, 255, 255, 0.85); }
.hero h1 { font-size: clamp(30px, 5vw, 48px); margin: 4px 0 2px; text-shadow: 0 2px 16px rgba(0, 0, 0, 0.35); }
.hero .note { color: rgba(255, 255, 255, 0.86); font-size: 16px; }
.hero .acts { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 18px; }
.play {
  display: inline-flex; align-items: center; gap: 10px; text-decoration: none; background: var(--gold); color: var(--gold-ink);
  font-weight: 800; font-size: 17px; letter-spacing: 0.04em; padding: 12px 26px 12px 20px; border-radius: 10px; box-shadow: 0 6px 22px rgba(var(--accent-rgb), 0.35);
}
.play:hover { filter: brightness(1.08); transform: translateY(-1px); }
.play svg { width: 18px; height: 18px; fill: currentColor; }
.where { font-size: 13px; color: rgba(255, 255, 255, 0.7); overflow-wrap: anywhere; }

/* ---- ライブラリのタイル */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.tile {
  display: grid; grid-template-rows: auto auto; text-decoration: none; border-radius: var(--radius); overflow: hidden; background: var(--panel);
  border: 1px solid var(--line); transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}
.tile:hover, .tile:focus-visible { transform: translateY(-4px); border-color: var(--gold); box-shadow: 0 14px 30px rgba(0, 0, 0, 0.45); }
.tile .art { aspect-ratio: 16 / 10; }
.tile .open {
  position: absolute; left: 12px; bottom: 10px; z-index: 1; font-size: 12px; font-weight: 800; letter-spacing: 0.1em;
  background: rgba(8, 11, 16, 0.6); border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 999px; padding: 3px 10px; opacity: 0; transition: opacity 0.14s ease;
}
.tile:hover .open, .tile:focus-visible .open { opacity: 1; }
.tile .label { padding: 11px 13px 13px; display: grid; gap: 2px; min-width: 0; }
.tile .name { font-weight: 700; font-size: 16px; overflow-wrap: anywhere; }
.tile .note { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; min-height: 1.3em; }
.tile.off { opacity: 0.55; }
.tile.off:hover { opacity: 0.9; }

/* タイルのリンクと操作ボタンを分け、タップで誤ってアプリを開かないようにする。 */
.library-card { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.library-card .tile { flex: 1; }
.library-controls { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.library-controls button { min-height: 44px; padding: 8px; font-size: 13px; color: var(--muted); border-radius: 7px; }
.library-controls button:hover:not(:disabled) { background: var(--panel-2); color: var(--fg); }
.library-controls .favorite[aria-pressed="true"] { color: var(--gold); }
.move-buttons { display: flex; flex-wrap: wrap; width: 100%; }
.guide { max-width: 800px; display: grid; gap: 20px; }
.guide-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.guide .play { justify-self: start; }
.device-list { max-width: 800px; }
.device-item .title { font-size: 16px; }
.device-item + .device-item { border-top: 1px solid var(--line); }
.tag { position: absolute; top: 10px; left: 10px; z-index: 1; font-size: 11px; font-weight: 800; letter-spacing: 0.06em; padding: 2px 8px; border-radius: 6px; background: rgba(8, 11, 16, 0.75); border: 1px solid rgba(255, 255, 255, 0.2); }
.tag.out { left: auto; right: 10px; }
.empty { border: 1px dashed var(--line); border-radius: var(--radius); padding: 28px; text-align: center; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .tile, .tile .open, .play { transition: none; } .tile:hover, .play:hover { transform: none; } }

/* ---- パネル（アカウント・管理者の画面） */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.panel > * + * { border-top: 1px solid var(--line); }
.panel.pad { padding: 18px; display: grid; gap: 12px; }
.panel.pad > * + * { border-top: 0; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 16px; min-height: 50px; width: 100%; text-align: left; text-decoration: none; }
button.row:hover { background: var(--panel-2); }
.row .k { color: var(--muted); font-size: 14px; flex: none; }
.row .v { text-align: right; overflow-wrap: anywhere; min-width: 0; font-weight: 600; }
.row.go { color: var(--fg); font-weight: 600; }
.row.go::after { content: "›"; color: var(--dim); font-size: 20px; line-height: 1; }
.row.danger, .danger { color: var(--red); }
.profile { display: flex; align-items: center; gap: 16px; padding: 18px; }
.profile .big-name { font-size: 24px; font-weight: 800; overflow-wrap: anywhere; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; align-items: start; }
.stack { display: grid; gap: 10px; align-content: start; }
.badge { font-size: 11px; font-weight: 800; letter-spacing: 0.06em; padding: 2px 8px; border-radius: 6px; background: rgba(var(--accent-rgb), 0.16); color: var(--gold); }
.badge.off { background: rgba(255, 107, 97, 0.16); color: var(--red); }
.badge.on { background: rgba(79, 210, 138, 0.16); color: var(--green); }
.chip { font-size: 12px; background: var(--panel-3); border-radius: 6px; padding: 2px 7px; font-family: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.item { display: grid; gap: 9px; padding: 14px 16px; }
.item .top { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.item .title { font-weight: 700; overflow-wrap: anywhere; }
.item .acts { display: flex; flex-wrap: wrap; gap: 6px 8px; }
.item .acts button { font-size: 13px; font-weight: 600; padding: 5px 10px; border-radius: 7px; border: 1px solid var(--line); color: var(--muted); }
.item .acts button:hover:not(:disabled) { color: var(--fg); background: var(--panel-2); border-color: var(--dim); }
.item .acts button.danger { color: var(--red); }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch { width: 28px; height: 28px; border-radius: 8px; border: 2px solid transparent; }
.swatch[aria-pressed="true"] { border-color: var(--fg); }
.inline { display: flex; gap: 8px; }
.inline input { min-width: 0; flex: 1; }
.back { color: var(--muted); font-size: 14px; font-weight: 600; justify-self: start; }
.back:hover { color: var(--fg); }

/* ---- 入力 */
label { display: grid; gap: 5px; font-size: 13px; color: var(--muted); }
input[type="text"], input[type="password"] {
  font: inherit; color: var(--fg); background: var(--input-bg); border: 1px solid var(--line); border-radius: 9px;
  padding: 10px 12px; width: 100%; min-height: 44px; -webkit-appearance: none; appearance: none;
}
input:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.18); }
.primary { background: var(--gold); color: var(--gold-ink); font-weight: 800; border-radius: 10px; padding: 12px; min-height: 46px; letter-spacing: 0.04em; }
.primary:hover:not(:disabled) { filter: brightness(1.08); }
form.panel.pad { max-width: 460px; }
.hint { font-size: 13px; min-height: 1.4em; }
.hint.ok { color: var(--green); }
.hint.bad { color: var(--red); }
.linkish { color: var(--gold); font-size: 14px; font-weight: 600; justify-self: start; }
.code {
  font-family: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace; font-size: 22px; font-weight: 700; letter-spacing: 0.06em;
  background: var(--input-bg); border: 1px dashed var(--gold); color: var(--gold); border-radius: 12px; padding: 16px 8px; text-align: center; overflow-wrap: anywhere; user-select: all;
}
.check { display: flex; gap: 10px; align-items: flex-start; color: var(--fg); font-size: 15px; }
.check input { width: 20px; height: 20px; flex: none; margin: 2px 0 0; accent-color: var(--gold); }

/* ---- ログインの前（入口） */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 28px 16px; }
.gate .box { width: 100%; max-width: 420px; display: grid; gap: 18px; }
.gate .logo { justify-content: center; }
.gate .logo svg { width: 54px; height: 54px; }
.gate .logo .word { font-size: 20px; }
.gate .lead { text-align: center; color: var(--muted); font-size: 14px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--input-bg); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.tabs button { padding: 8px; border-radius: 8px; color: var(--muted); font-weight: 700; font-size: 14px; }
.tabs button[aria-selected="true"] { background: var(--panel-3); color: var(--fg); }

/* ---- せまい画面: 柱を、上の帯にする */
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side .logo svg { width: 30px; height: 30px; }
  .side .logo .word { font-size: 12px; }
  .who { margin: 0 0 0 auto; border: 0; padding: 0; grid-auto-flow: column; align-items: center; }
  .who .text { display: none; }
  .who .ghost { padding: 6px 10px; font-size: 13px; }
  .nav { order: 3; width: 100%; grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto; gap: 6px; scrollbar-width: none; }
  .nav-label { display: none; }
  .nav button { border-left: 0; border-bottom: 3px solid transparent; padding: 7px 10px; font-size: 14px; }
  .nav button[aria-current="page"] { border-bottom-color: var(--gold); }
  .stage { padding: 18px 16px 48px; gap: 20px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .hero { min-height: 190px; }
  .tile .open { display: none; }
  .profile { padding: 14px; }
}

/* ---- 仕上げ */
.status:empty { display: none; }                        /* 知らせが無いときは、すき間を作らない */
.who .text { display: grid; min-width: 0; line-height: 1.25; }
@media (max-width: 760px) { .hero .glyph { font-size: 230px; bottom: -44px; right: -2%; } .who .text { display: none; } }

/* ---- アイコン画像 */
img.avatar { object-fit: cover; padding: 0; background: var(--panel-3); }
.pick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.stack.small-gap { gap: 6px; min-width: 0; }
.linkish.danger { color: var(--red); }

/* ---- タイルの絵（管理者が入れた画像）。色の面の上に、いっぱいに敷く */
.art .pic { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; z-index: 0; }
.hero .pic { filter: brightness(0.62); }                 /* 帯では、上に字をのせるので、少し暗くする */
.art-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.thumb { width: 96px; aspect-ratio: 16 / 10; border-radius: 8px; flex: none; border: 1px solid var(--line); }
.thumb .glyph { font-size: 60px; bottom: -14px; right: 4px; }

/* ---- お知らせ（ライブラリのいちばん上） */
.notice {
  display: flex; gap: 14px; align-items: flex-start; padding: 14px 18px; border-radius: var(--radius);
  background: rgba(var(--accent-rgb), 0.1); border: 1px solid rgba(var(--accent-rgb), 0.45);
}
.notice svg { width: 24px; height: 24px; flex: none; margin-top: 2px; fill: none; stroke: var(--gold); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.notice > div { min-width: 0; display: grid; gap: 2px; }
.notice .text { white-space: pre-wrap; overflow-wrap: anywhere; }
textarea {
  width: 100%; background: var(--bg); color: var(--fg); border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px;
  font: inherit; resize: vertical; min-height: 96px;
}
textarea:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.18); }
.acts-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.acts-row .primary { width: auto; padding: 12px 20px; }

/* アカウントごとの見た目。画像やアプリ固有の色はそのまま。 */
:root[data-appearance-mode="light"] {
  color-scheme: light;
  --side-top: #ffffff; --side-bottom: #eaf0f7;
  --bg: #f4f6fa; --panel: #ffffff; --panel-2: #eaf0f7; --panel-3: #dce5f1;
  --line: #c6d0de; --fg: #172234; --muted: #526077; --dim: #65758b;
  --input-bg: #ffffff; --red: #b9322b; --green: #147545;
}
.appearance-options { display: flex; gap: 8px; flex-wrap: wrap; }
.appearance-choice { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 9px 13px; border: 2px solid var(--line); border-radius: 10px; background: var(--panel); }
.appearance-choice[aria-pressed="true"] { border-color: var(--gold); background: var(--panel-2); font-weight: 700; }
.appearance-dot { width: 16px; height: 16px; flex: none; border-radius: 50%; background: var(--choice-color); box-shadow: 0 0 0 1px rgba(0,0,0,0.2); }
.appearance-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.appearance-dot-gold { --choice-color: #f2b441; }
.appearance-dot-blue { --choice-color: #79b7ff; }
.appearance-dot-green { --choice-color: #65d6a0; }
.appearance-dot-violet { --choice-color: #bb9aff; }
.appearance-dot-rose { --choice-color: #ff91b7; }
.appearance-dot-orange { --choice-color: #ffac75; }
