/* =====================================================================
   DigiGo テーマ「DEGI SPACE」（#063。PM 提供デザイン参考を元に実装）
   html[data-dg-theme="space"] のときだけ効く。classic のときは従来の game-ui.css のまま。
   data-dg-mode="dark"（黒系・既定） / "yellow"（黄色）。
   ===================================================================== */

/* ---------- 共通トークン ---------- */
html[data-dg-theme="space"] {
  --sp-yellow: #ffcc00; --sp-yellow2: #ffda33; --sp-acid: #a8ff18; --sp-cyan: #31d9ff; --sp-pink: #ff548f;
  --sp-ink: #11110f; --sp-paper: #f7f7ee;
  --sp-bg: #0e100f; --sp-panel: rgba(27,29,29,.9); --sp-panel-solid: #1b1d1d; --sp-line: rgba(255,204,0,.35);
  --sp-text: #f7f7ee; --sp-sub: #aeb3ae; --sp-accent: var(--sp-yellow); --sp-btn-shadow: #9d9000;
  --sp-cut: 14px;
  /* game-ui.css の変数を黒テーマ向けに差し替え（ほとんどの部品がこれで追従する） */
  --pop-ink: #f7f7ee; --pop-paper: #1b1d1d; --pop-yellow: #ffcc00; --pop-cyan: #31d9ff; --pop-magenta: #ff548f;
  --pop-cyan-pale: #203038; --pop-magenta-pale: #3a2030; --pop-yellow-pale: #3a3414;
  --pop-shadow: 0 10px 30px rgba(0,0,0,.35); --pop-shadow-sm: 0 4px 14px rgba(0,0,0,.3);
  --dg-text-sub: #aeb3ae;
}
html[data-dg-theme="space"][data-dg-mode="yellow"] {
  --sp-bg: #ffcc00; --sp-panel: #f8f8f2; --sp-panel-solid: #f8f8f2; --sp-line: #11110f;
  --sp-text: #11110f; --sp-sub: #4b4112; --sp-accent: #11110f; --sp-btn-shadow: #11110f;
  --pop-ink: #11110f; --pop-paper: #f8f8f2; --pop-cyan-pale: #dff7ff; --pop-magenta-pale: #ffe1ee; --pop-yellow-pale: #fff3b0;
  --pop-shadow: 6px 6px 0 rgba(17,17,15,.16); --pop-shadow-sm: 4px 4px 0 rgba(17,17,15,.14);
  --dg-text-sub: #4b4112;
}
html[data-dg-theme="space"] .tech,
html[data-dg-theme="space"] .dash-section-title,
html[data-dg-theme="space"] .dash-logo { font-family: "Chakra Petch", "Noto Sans JP", sans-serif; letter-spacing: .05em; }
html[data-dg-theme="space"] body { font-family: "Noto Sans JP", "M PLUS Rounded 1c", sans-serif; }
.dgs-only { display: none !important; }
html[data-dg-theme="space"] .dgs-only { display: revert !important; }
html[data-dg-theme="space"] .dgc-only { display: none !important; }

/* ---------- 背景（黒: グリッド＋黄の光 / 黄: ドット） ---------- */
html[data-dg-theme="space"], html[data-dg-theme="space"] body { background: var(--sp-bg); color: var(--sp-text); }
html[data-dg-theme="space"] #student-dashboard,
html[data-dg-theme="space"] #center-panel,
html[data-dg-theme="space"] #mission-creator {
  background-color: var(--sp-bg);
  background-image:
    radial-gradient(circle at 68% 30%, rgba(255,204,0,.13), transparent 40%),
    linear-gradient(rgba(255,204,0,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,204,0,.06) 1px, transparent 1px);
  background-size: 100% 100%, 80px 80px, 80px 80px;
  background-attachment: fixed;
  color: var(--sp-text);
}
html[data-dg-theme="space"][data-dg-mode="yellow"] #student-dashboard,
html[data-dg-theme="space"][data-dg-mode="yellow"] #center-panel,
html[data-dg-theme="space"][data-dg-mode="yellow"] #mission-creator {
  background-image: radial-gradient(circle, rgba(17,17,15,.16) 1.2px, transparent 1.3px), radial-gradient(circle at 70% 30%, rgba(255,255,255,.34), transparent 44%);
  background-size: 22px 22px, 100% 100%;
}

/* ---------- ログイン（参考 index.html を忠実に: 全面イラスト＋右に暗いグラデ、右パネルは透過＋円の線＋黄の角） ---------- */
/* ※ display はログイン状態のときだけ（main.css の #login-screen{display:none} を上書きしないこと。#064 追加1 の不具合） */
html[data-dg-theme="space"] body.state-login #login-screen { display: grid; }
html[data-dg-theme="space"] #login-screen {
  grid-template-columns: minmax(320px, 1.05fr) minmax(420px, .95fr); align-items: stretch; justify-items: stretch;
  background: #ffcc00; background-image: none; min-height: 100vh; padding: 0; overflow: hidden; position: relative; color: #11110f;
  font-family: "Noto Sans JP", sans-serif;
}
html[data-dg-theme="space"] #login-screen .login-bg { display: none !important; }
html[data-dg-theme="space"] .dgs-login-art { position: absolute; inset: 0; background: url(../assets/theme/digigo-world.png) center / cover no-repeat; z-index: 0; display: block !important; }
html[data-dg-theme="space"] .dgs-login-vignette { position: absolute; inset: 0; z-index: 0; display: block !important;
  background: linear-gradient(270deg, rgba(4,6,16,.98) 0%, rgba(4,6,16,.9) 30%, rgba(4,6,16,.3) 58%, rgba(4,6,16,.05) 100%), linear-gradient(0deg, rgba(4,6,16,.5), transparent 40%); }
html[data-dg-theme="space"] .dgs-login-hero { position: relative; z-index: 1; display: flex !important; flex-direction: column; justify-content: space-between; padding: 38px 5vw 50px; min-height: 100vh; }
.dgs-brand { display: flex; align-items: center; gap: 14px; font-weight: 800; font-size: 1.25rem; color: #11110f; }
.dgs-brand-mark { width: 40px; height: 40px; background: #11110f; clip-path: polygon(0 10%,70% 10%,100% 50%,70% 90%,0 90%,28% 50%); position: relative; }
.dgs-brand-mark::after { content: ""; position: absolute; width: 9px; height: 9px; background: #ffcc00; border-radius: 50%; left: 15px; top: 15px; box-shadow: 0 0 0 4px rgba(244,223,0,.2); }
.dgs-brand small { display: block; font-size: .62rem; letter-spacing: .24em; margin-top: 2px; }
.dgs-hero-copy { max-width: 720px; margin: auto 0; }
.dgs-eyebrow { display: inline-flex; align-items: center; gap: 10px; background: #11110f; color: #ffcc00; padding: 9px 14px; border-radius: 4px; font-size: .72rem; font-weight: 800; }
.dgs-eyebrow::before { content: ""; width: 7px; height: 7px; background: #a8ff18; border-radius: 50%; box-shadow: 0 0 12px #a8ff18; animation: dgsBlink 1.3s infinite; }
.dgs-hero-copy h1 { font-size: clamp(3.6rem, 8.2vw, 8.2rem); line-height: .8; margin: 30px 0 24px; letter-spacing: 0; font-weight: 800; color: #fff; font-family: "Noto Sans JP", sans-serif; }
.dgs-hero-copy h1 span { display: block; font-size: .34em; letter-spacing: .02em; margin-left: .12em; margin-top: 1.35em; }
.dgs-hero-copy p { font-size: clamp(1rem, 1.4vw, 1.25rem); line-height: 1.9; font-weight: 700; max-width: 570px; color: #fff; text-shadow: 2px 2px #000; }
.dgs-data-row { display: flex; gap: 26px; flex-wrap: wrap; color: #11110f; }
.dgs-data-row div { border-left: 2px solid #11110f; padding-left: 11px; }
.dgs-data-row b { display: block; font-size: .95rem; }
.dgs-data-row span { font-size: .66rem; font-weight: 700; letter-spacing: .1em; }
/* 右パネル（背景は透過＝奥のイラスト＋暗いグラデが見える） */
html[data-dg-theme="space"] #login-screen > .login-card {
  position: relative; z-index: 1; margin: 16px; min-height: calc(100vh - 32px); max-width: none; width: auto; border-radius: 28px; border: 0;
  background: transparent; color: #f7f7ee; box-shadow: -14px 14px 0 rgba(0,0,0,.12); overflow: hidden;
  display: grid; place-items: center; align-content: center; padding: 50px 8%; gap: 0; animation: none; text-align: left;
}
html[data-dg-theme="space"] .login-card::before, html[data-dg-theme="space"] .login-card::after {
  content: ""; position: absolute; border: 1px solid rgba(49,217,255,.27); border-radius: 50%; background: none; z-index: 0; pointer-events: none;
}
html[data-dg-theme="space"] .login-card::before { width: 420px; height: 420px; top: -180px; right: -150px; left: auto; bottom: auto; box-shadow: 0 0 60px rgba(49,217,255,.1); }
html[data-dg-theme="space"] .login-card::after { width: 260px; height: 260px; bottom: -170px; left: -60px; top: auto; right: auto; border-color: rgba(168,255,24,.25); }
html[data-dg-theme="space"] .login-card > *:not(.dgs-corner) { width: min(440px, 100%); margin: 0; position: relative; z-index: 2; }
html[data-dg-theme="space"] .login-card > .dgs-corner { position: absolute; width: 90px; height: 90px; border-color: #ffcc00; opacity: .8; z-index: 1; }
.dgs-corner.tl { top: 22px; left: 22px; border-top: 2px solid; border-left: 2px solid; }
.dgs-corner.br { bottom: 22px; right: 22px; border-bottom: 2px solid; border-right: 2px solid; }
html[data-dg-theme="space"] .login-mascot, html[data-dg-theme="space"] .login-card .login-logo { display: none !important; }
.dgs-login-head .num { font-size: .72rem; color: #ffcc00; margin-bottom: 9px; font-family: "Chakra Petch", sans-serif; letter-spacing: .06em; }
.dgs-login-head h2 { font-size: clamp(2rem, 3vw, 3rem); margin: 0 0 8px; line-height: 1; color: #f7f7ee; }
.dgs-login-head p { color: #9ea49e; margin: 0 0 32px; font-size: .95rem; }
html[data-dg-theme="space"] .dgs-field-label { display: flex !important; justify-content: space-between; font-size: .72rem; color: #c8cbc5; margin: 18px 0 8px !important; }
html[data-dg-theme="space"] .login-input {
  width: 100%; height: auto; border: 1px solid #414541; background: #242725; color: #fff; border-radius: 9px; padding: 16px 18px; box-shadow: none; text-align: left; font-size: 1rem; font-weight: 500; outline: none; transition: .2s;
}
html[data-dg-theme="space"] .login-input::placeholder { color: #6f756f; }
html[data-dg-theme="space"] .login-input:focus { border-color: #31d9ff; box-shadow: 0 0 0 3px rgba(49,217,255,.12); transform: none; }
html[data-dg-theme="space"] .login-error { min-height: 22px; background: transparent; border: 0; color: #ff4f70; font-size: .75rem; margin-top: 8px !important; animation: none; padding: 0; }
html[data-dg-theme="space"] .login-submit-btn {
  width: min(440px, 100%) !important; height: auto; margin: 14px 0 0 !important; padding: 17px; border: 0; border-radius: 9px; background: #ffcc00 !important; color: #11110f !important;
  font-weight: 800; font-size: 1rem; display: flex !important; justify-content: space-between; align-items: center; box-shadow: 0 5px 0 #9d9000 !important; transition: .2s; filter: none;
}
html[data-dg-theme="space"] .login-submit-btn::before { display: none; }
html[data-dg-theme="space"] .login-submit-btn::after { content: "→"; font-size: 1.4rem; }
html[data-dg-theme="space"] .login-submit-btn:hover { background: #ffda33 !important; transform: translateY(-2px); box-shadow: 0 7px 0 #9d9000 !important; }
html[data-dg-theme="space"] .login-submit-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #9d9000 !important; }
.dgs-login-help { text-align: center; font-size: .78rem; color: #777e78; margin-top: 25px !important; }
/* ログイン画面のデザイン切り替え */
.dg-theme-switch { position: absolute; right: 18px; bottom: 14px; z-index: 5; display: flex; gap: 6px; align-items: center; font-size: .72rem; }
.dg-theme-switch button { border: 1px solid rgba(128,128,128,.5); background: rgba(0,0,0,.35); color: #fff; padding: 6px 10px; border-radius: 8px; cursor: pointer; font-weight: 700; font-family: inherit; }
.dg-theme-switch button.active { background: #ffcc00; color: #11110f; border-color: #11110f; }
html[data-dg-theme="space"] #login-screen .dg-theme-switch { color: #c8cbc5; }
html:not([data-dg-theme="space"]) .dg-theme-switch button { background: #fff; color: #111; border-color: #111; }
/* 黄モード: イラストは同じ。左側の文字色は参考どおり */
@media (max-width: 900px) {
  html[data-dg-theme="space"] #login-screen { grid-template-columns: 1fr; }
  html[data-dg-theme="space"] .dgs-login-hero { min-height: 44vh; padding: 25px 24px; }
  .dgs-hero-copy { margin: 50px 0; }
  .dgs-hero-copy h1 { font-size: clamp(3.4rem, 16vw, 6rem); }
  .dgs-data-row { display: none; }
  html[data-dg-theme="space"] #login-screen > .login-card { margin: 0; min-height: 56vh; border-radius: 28px 28px 0 0; padding: 52px 24px; background: rgba(4,6,16,.92); }
}
@media (max-width: 600px) { .dgs-hero-copy p { font-size: .92rem; } html[data-dg-theme="space"] #login-screen > .login-card { padding-top: 42px; } .dgs-login-head h2 { font-size: 2rem; } }
@keyframes dgsBlink { 50% { opacity: .35; transform: scale(.7); } }

/* ---------- ダッシュボード上部（参考 dashboard.html: 切り替え・おかえり・レベルボックス） ---------- */
.dgs-view-switch { display: flex; align-items: center; gap: 10px; margin-left: auto; margin-right: 10px; }
.dgs-view-switch button { color: var(--sp-yellow); background: transparent; border: 1px solid rgba(255,204,0,.35); border-radius: 9px; padding: 9px 12px; font-size: .7rem; cursor: pointer; font-weight: 700; }
.dgs-view-switch button.active { background: var(--sp-yellow); color: var(--sp-ink); }
.dgs-server { font-size: .72rem; color: #cbd1cb; }
.dgs-server b { color: var(--sp-acid); }
html[data-dg-theme="space"][data-dg-mode="yellow"] .dgs-view-switch button { color: var(--sp-ink); border-color: rgba(17,17,15,.4); }
html[data-dg-theme="space"][data-dg-mode="yellow"] .dgs-view-switch button.active { background: var(--sp-ink); color: var(--sp-yellow); }
html[data-dg-theme="space"][data-dg-mode="yellow"] .dgs-server { color: #443d18; }
html[data-dg-theme="space"][data-dg-mode="yellow"] .dgs-server b { color: #176c28; }
html[data-dg-theme="space"] .dgs-welcome { display: grid !important; grid-template-columns: 1.15fr .85fr; gap: 30px; align-items: end; margin: 18px 0 34px; }
.dgs-eyebrow2 { display: inline-flex; background: var(--sp-yellow); color: var(--sp-ink); padding: 8px 13px; border-radius: 4px; font-size: .72rem; font-weight: 800; }
.dgs-welcome h1 { font-size: clamp(2.4rem, 5vw, 5rem); line-height: .98; margin: 14px 0 16px; letter-spacing: -.04em; color: var(--sp-text); }
.dgs-welcome h1 em { font-style: normal; color: var(--sp-yellow); }
.dgs-welcome p { color: #aeb3ae; line-height: 1.8; max-width: 650px; }
.dgs-levelbox { position: relative; isolation: isolate; justify-self: end; width: min(430px, 100%); padding: 21px 23px; background: rgba(255,204,0,.42); clip-path: polygon(0 0, calc(100% - 25px) 0, 100% 25px, 100% 100%, 0 100%); }
.dgs-levelbox::before { content: ""; position: absolute; z-index: -1; inset: 1px; background: rgba(27,29,29,.96); clip-path: polygon(0 0, calc(100% - 24px) 0, 100% 24px, 100% 100%, 0 100%); }
.dgs-leveltop { display: flex; justify-content: space-between; color: var(--sp-text); }
.dgs-leveltop small { font-size: .65rem; color: #aeb3ae; }
.dgs-level { font-size: 2.4rem; color: var(--sp-yellow); font-weight: 700; }
.dgs-rank { text-align: right; font-size: .72rem; }
.dgs-rank b { color: var(--sp-cyan); font-size: 1rem; }
.dgs-progress { height: 10px; border: 1px solid #555; padding: 2px; margin-top: 15px; }
.dgs-progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--sp-yellow), var(--sp-acid)); box-shadow: 0 0 10px rgba(168,255,24,.45); transition: width .6s; }
.dgs-progress-copy { display: flex; justify-content: space-between; font-size: .68rem; color: #aeb3ae; margin-top: 8px; }
html[data-dg-theme="space"][data-dg-mode="yellow"] .dgs-eyebrow2 { background: var(--sp-ink); color: var(--sp-yellow); }
html[data-dg-theme="space"][data-dg-mode="yellow"] .dgs-welcome h1 em { color: var(--sp-ink); text-decoration: underline; text-decoration-thickness: 4px; text-underline-offset: 8px; }
html[data-dg-theme="space"][data-dg-mode="yellow"] .dgs-welcome p { color: #443d18; }
html[data-dg-theme="space"][data-dg-mode="yellow"] .dgs-levelbox { background: var(--sp-ink); }
html[data-dg-theme="space"][data-dg-mode="yellow"] .dgs-levelbox::before { background: var(--sp-paper); }
html[data-dg-theme="space"][data-dg-mode="yellow"] .dgs-leveltop, html[data-dg-theme="space"][data-dg-mode="yellow"] .dgs-level { color: var(--sp-ink); }
html[data-dg-theme="space"][data-dg-mode="yellow"] .dgs-progress { border-color: var(--sp-ink); }
html[data-dg-theme="space"][data-dg-mode="yellow"] .dgs-progress i { background: var(--sp-ink); box-shadow: none; }
html[data-dg-theme="space"][data-dg-mode="yellow"] .dgs-rank b { color: #176c28; }
@media (max-width: 900px) { html[data-dg-theme="space"] .dgs-welcome { grid-template-columns: 1fr; } .dgs-levelbox { justify-self: start; } .dgs-server { display: none; } }
@media (max-width: 600px) { .dgs-welcome h1 { font-size: 2.5rem; } .dgs-view-switch button { padding: 7px; } }

/* ---------- ヘッダー（トップバー） ---------- */
html[data-dg-theme="space"] .dash-header { background: rgba(14,16,15,.88); border-bottom: 1px solid var(--sp-line); backdrop-filter: blur(10px); color: var(--sp-text); min-height: 64px; padding: 8px 24px; }
html[data-dg-theme="space"][data-dg-mode="yellow"] .dash-header { background: rgba(255,204,0,.94); }
html[data-dg-theme="space"] .dash-header::after { display: none; }
html[data-dg-theme="space"] .dash-logo { background: none; clip-path: none; color: var(--sp-text); padding: 0 0 0 50px; font-size: 1.2rem; font-weight: 800; position: relative; }
html[data-dg-theme="space"] .dash-logo::before { content: ""; position: absolute; left: 0; top: 50%; width: 38px; height: 38px; transform: translateY(-50%); background: var(--sp-yellow); clip-path: polygon(0 10%,70% 10%,100% 50%,70% 90%,0 90%,28% 50%); }
html[data-dg-theme="space"][data-dg-mode="yellow"] .dash-logo::before { background: var(--sp-ink); }
html[data-dg-theme="space"] .dash-room-title { color: var(--sp-sub); font-size: .95rem; flex: 0 1 auto; }
html[data-dg-theme="space"] .dash-room-title rt { color: var(--sp-accent); }
html[data-dg-theme="space"] .dash-logout-btn { background: var(--sp-yellow); color: var(--sp-ink); border: 0; border-radius: 12px; box-shadow: none; }
html[data-dg-theme="space"][data-dg-mode="yellow"] .dash-logout-btn { background: var(--sp-ink); color: var(--sp-yellow); }
html[data-dg-theme="space"] .dash-mascot-mini { filter: none; }

/* ---------- 本体 ---------- */
html[data-dg-theme="space"] .dash-body { padding: 28px 28px 130px; }
html[data-dg-theme="space"] .dash-body > * { max-width: 1400px; }

/* 見出し: 大きな文字 ＋ 下に黄の斜め帯 */
html[data-dg-theme="space"] .dash-section-title,
html[data-dg-theme="space"] .mission-world-title {
  display: block; background: none; clip-path: none; padding: 0 0 12px; color: var(--sp-text); font-size: clamp(1.4rem, 2.6vw, 2.2rem); font-weight: 800;
  border-bottom: 5px solid var(--sp-accent); transform: skewX(-6deg); margin: 6px 0 20px; letter-spacing: .02em;
}
html[data-dg-theme="space"] .dash-section-title > *, html[data-dg-theme="space"] .dash-section-title { transform-origin: left; }
html[data-dg-theme="space"] .dash-section-title rt { color: var(--sp-accent); }
html[data-dg-theme="space"] .dash-section-sub { color: var(--sp-text); }
html[data-dg-theme="space"] .dg-muted, html[data-dg-theme="space"] .dash-openworld-note, html[data-dg-theme="space"] .dash-comingsoon,
html[data-dg-theme="space"] .mission-world-meta, html[data-dg-theme="space"] .panel-loading { color: var(--sp-sub); }

/* パネル: 切り欠き角 ＋ 細い黄の枠（CMY の角飾りは消す） */
html[data-dg-theme="space"] .pop-panel, html[data-dg-theme="space"] .dash-stat-card, html[data-dg-theme="space"] .world-card,
html[data-dg-theme="space"] .spot-card, html[data-dg-theme="space"] .result-card, html[data-dg-theme="space"] .mc-panel,
html[data-dg-theme="space"] .mycode-card, html[data-dg-theme="space"] .quest-card, html[data-dg-theme="space"] .mission-world-locked,
html[data-dg-theme="space"] .dg-world-card, html[data-dg-theme="space"] .dg-settings-block, html[data-dg-theme="space"] .dg-study-card, html[data-dg-theme="space"] .dg-study-level {
  background: var(--sp-panel); color: var(--sp-text); border: 1px solid var(--sp-line); border-radius: 0; box-shadow: var(--pop-shadow);
  clip-path: polygon(var(--sp-cut) 0, 100% 0, 100% calc(100% - var(--sp-cut)), calc(100% - var(--sp-cut)) 100%, 0 100%, 0 var(--sp-cut));
  backdrop-filter: blur(8px);
}
html[data-dg-theme="space"] .dg-settings-block { padding: 18px 20px; margin-bottom: 16px; }
html[data-dg-theme="space"] .pop-panel::before, html[data-dg-theme="space"] .pop-panel::after,
html[data-dg-theme="space"] .dash-stat-card::before, html[data-dg-theme="space"] .dash-stat-card::after,
html[data-dg-theme="space"] .world-card::before, html[data-dg-theme="space"] .world-card::after,
html[data-dg-theme="space"] .spot-card::before, html[data-dg-theme="space"] .spot-card::after,
html[data-dg-theme="space"] .result-card::before, html[data-dg-theme="space"] .result-card::after,
html[data-dg-theme="space"] .mc-panel::before, html[data-dg-theme="space"] .mc-panel::after { display: none; }
html[data-dg-theme="space"] .world-card:hover, html[data-dg-theme="space"] .spot-card:hover { transform: translateY(-5px); border-color: var(--sp-yellow); }
html[data-dg-theme="space"] .world-card-title, html[data-dg-theme="space"] .spot-card-title { color: var(--sp-text); }
html[data-dg-theme="space"] .world-card-subtitle, html[data-dg-theme="space"] .spot-card-desc { color: var(--sp-sub); }
html[data-dg-theme="space"] .world-card-progress { background: #161817; border: 1px solid #555; }
html[data-dg-theme="space"] .world-card-progress-bar { background: linear-gradient(90deg, var(--sp-yellow), var(--sp-acid)); }

/* ステータス → レベルボックス風 */
html[data-dg-theme="space"] .dash-status-cards { gap: 15px; }
html[data-dg-theme="space"] .dash-stat-card { border-left: 3px solid var(--sp-cyan); clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 0 100%); animation: none; }
html[data-dg-theme="space"] .dash-stat-card:nth-child(2) { border-left-color: var(--sp-acid); }
html[data-dg-theme="space"] .dash-stat-card:nth-child(3) { border-left-color: var(--sp-yellow); }
html[data-dg-theme="space"] .dash-stat-value { color: var(--sp-accent); font-family: "Chakra Petch", sans-serif; font-weight: 700; }
html[data-dg-theme="space"][data-dg-mode="yellow"] .dash-stat-value { color: var(--sp-ink); }
html[data-dg-theme="space"] .dash-stat-label { color: var(--sp-sub); }
html[data-dg-theme="space"] .dg-gauge { background: #161817; border: 1px solid #555; padding: 2px; height: 12px; }
html[data-dg-theme="space"] .dg-gauge-fill { background: linear-gradient(90deg, var(--sp-yellow), var(--sp-acid)); box-shadow: 0 0 10px rgba(168,255,24,.45); }
html[data-dg-theme="space"][data-dg-mode="yellow"] .dg-gauge { background: #fff; border-color: var(--sp-ink); }
html[data-dg-theme="space"][data-dg-mode="yellow"] .dg-gauge-fill { background: var(--sp-ink); box-shadow: none; }

/* タブ → 画面下のドック（アイコン＋文字） */
html[data-dg-theme="space"] .dash-mode-tabs {
  position: fixed; z-index: 60; left: 50%; bottom: 14px; transform: translateX(-50%); width: max-content; max-width: calc(100% - 20px);
  display: flex; gap: 4px; padding: 8px; margin: 0; overflow-x: auto; scrollbar-width: none;
  background: rgba(18,20,19,.94); border: 1px solid rgba(255,204,0,.26); border-radius: 20px; backdrop-filter: blur(18px); box-shadow: 0 20px 55px rgba(0,0,0,.38);
}
html[data-dg-theme="space"] .dash-mode-tabs::-webkit-scrollbar { display: none; }
html[data-dg-theme="space"][data-dg-mode="yellow"] .dash-mode-tabs { background: var(--sp-ink); border-color: var(--sp-ink); }
html[data-dg-theme="space"][data-dg-mode="yellow"] .dash-mode-tab { color: #d6dad6; }
html[data-dg-theme="space"][data-dg-mode="yellow"] .dash-mode-tab.active { color: var(--sp-ink); }
html[data-dg-theme="space"] .dash-mode-tab {
  flex-direction: column; justify-content: center; gap: 3px; min-width: 92px; min-height: 60px; padding: 6px 8px; margin: 0; border-radius: 13px;
  color: #9aa09a; font-size: .7rem; font-weight: 700; animation: none; --pop-btn-bg: transparent;
}
html[data-dg-theme="space"] .dash-mode-tab::before { display: none; }
html[data-dg-theme="space"] .dash-mode-tab .dg-tab-ico { margin: 0; font-size: 1.3rem; width: 30px; height: 30px; display: grid; place-items: center; background-size: contain; background-repeat: no-repeat; background-position: center; }
html[data-dg-theme="space"] #tab-mission .dg-tab-ico { background-image: url(../assets/theme/menu-mission.svg); color: transparent; }
html[data-dg-theme="space"] #tab-openworld .dg-tab-ico { background-image: url(../assets/theme/menu-home.svg); color: transparent; }
html[data-dg-theme="space"] #tab-creative .dg-tab-ico { background-image: url(../assets/theme/menu-works.svg); color: transparent; }
html[data-dg-theme="space"] #tab-items .dg-tab-ico { background-image: url(../assets/theme/menu-data.svg); color: transparent; }
html[data-dg-theme="space"] .dash-mode-tab .dg-tab-label { white-space: nowrap; }
html[data-dg-theme="space"] .dash-mode-tab:hover { color: #fff; background: #292d2a; transform: none; }
html[data-dg-theme="space"] .dash-mode-tab:hover .dg-tab-ico { transform: translateY(-3px) scale(1.08); }
html[data-dg-theme="space"] .dash-mode-tab.active { background: var(--sp-yellow); color: var(--sp-ink); box-shadow: 0 0 25px rgba(255,204,0,.18); }
@media (max-width: 700px) {
  html[data-dg-theme="space"] .dash-mode-tab { min-width: 64px; font-size: .6rem; }
  html[data-dg-theme="space"] .dash-mode-tab .dg-tab-label { font-size: 0; }
  html[data-dg-theme="space"] .dash-mode-tab .dg-tab-label::after { content: attr(data-short); font-size: .6rem; }
}

/* ---------- ボタン（参考: ツールキット） ---------- */
html[data-dg-theme="space"] .dg-btn-primary, html[data-dg-theme="space"] .world-card-play-btn, html[data-dg-theme="space"] .spot-card-play-btn,
html[data-dg-theme="space"] .dg-create-mission-btn, html[data-dg-theme="space"] .mc-btn-next, html[data-dg-theme="space"] .mc-btn-submit,
html[data-dg-theme="space"] .dg-resume-btn, html[data-dg-theme="space"] .mycode-load-btn, html[data-dg-theme="space"] .pop-btn {
  color: var(--sp-ink) !important; filter: drop-shadow(0 4px 0 var(--sp-btn-shadow));
}
html[data-dg-theme="space"] .dg-btn-primary::before, html[data-dg-theme="space"] .world-card-play-btn::before, html[data-dg-theme="space"] .spot-card-play-btn::before,
html[data-dg-theme="space"] .dg-create-mission-btn::before, html[data-dg-theme="space"] .mc-btn-next::before, html[data-dg-theme="space"] .mc-btn-submit::before,
html[data-dg-theme="space"] .dg-resume-btn::before, html[data-dg-theme="space"] .mycode-load-btn::before, html[data-dg-theme="space"] .pop-btn::before {
  transform: none; border: 0; box-shadow: none; background: var(--sp-yellow); background-image: none;
  clip-path: polygon(9px 0, 100% 0, 100% calc(100% - 9px), calc(100% - 9px) 100%, 0 100%, 0 9px);
}
html[data-dg-theme="space"][data-dg-mode="yellow"] .dg-btn-primary::before, html[data-dg-theme="space"][data-dg-mode="yellow"] .world-card-play-btn::before,
html[data-dg-theme="space"][data-dg-mode="yellow"] .dg-create-mission-btn::before { background: var(--sp-ink); }
html[data-dg-theme="space"][data-dg-mode="yellow"] .dg-btn-primary, html[data-dg-theme="space"][data-dg-mode="yellow"] .world-card-play-btn,
html[data-dg-theme="space"][data-dg-mode="yellow"] .dg-create-mission-btn { color: var(--sp-yellow) !important; filter: drop-shadow(0 4px 0 rgba(17,17,15,.3)); }
html[data-dg-theme="space"] .dg-btn-primary:hover, html[data-dg-theme="space"] .world-card-play-btn:hover { transform: translateY(-2px); }
html[data-dg-theme="space"] .dg-btn-primary:active, html[data-dg-theme="space"] .world-card-play-btn:active { transform: translateY(3px); filter: drop-shadow(0 1px 0 var(--sp-btn-shadow)); }
html[data-dg-theme="space"] .pop-btn-ghost, html[data-dg-theme="space"] .dg-run-dialog-cancel-btn, html[data-dg-theme="space"] .mc-btn-back { color: var(--sp-text); }
html[data-dg-theme="space"] .pop-btn-ghost::before, html[data-dg-theme="space"] .dg-run-dialog-cancel-btn::before, html[data-dg-theme="space"] .mc-btn-back::before {
  transform: none; border: 1px solid var(--sp-line); box-shadow: none; background: rgba(40,44,41,.9);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}
html[data-dg-theme="space"][data-dg-mode="yellow"] .pop-btn-ghost::before { background: var(--sp-paper); border-color: var(--sp-ink); }
html[data-dg-theme="space"] .spot-filter-tab { background: rgba(40,44,41,.9); color: var(--sp-text); border: 1px solid var(--sp-line); border-radius: 0; clip-path: polygon(7px 0,100% 0,100% calc(100% - 7px),calc(100% - 7px) 100%,0 100%,0 7px); box-shadow: none; }
html[data-dg-theme="space"] .spot-filter-tab.active { background: var(--sp-yellow); color: var(--sp-ink); }
html[data-dg-theme="space"] input[type=text], html[data-dg-theme="space"] input[type=number], html[data-dg-theme="space"] input[type=password], html[data-dg-theme="space"] select, html[data-dg-theme="space"] textarea {
  background: #242725; color: #fff; border: 1px solid #414541; border-radius: 6px;
}
html[data-dg-theme="space"][data-dg-mode="yellow"] input[type=text], html[data-dg-theme="space"][data-dg-mode="yellow"] select, html[data-dg-theme="space"][data-dg-mode="yellow"] textarea { background: #fff; color: var(--sp-ink); border-color: var(--sp-ink); }

/* 学習モジュールの画面 */
html[data-dg-theme="space"] .dg-study-frame { background: var(--sp-bg); color: var(--sp-text); }
html[data-dg-theme="space"] .dg-study-head { background: #000; border-bottom: 2px solid var(--sp-yellow); }
html[data-dg-theme="space"] .dg-study-level-no { color: var(--sp-acid); }
html[data-dg-theme="space"] .dg-study-level-best { color: var(--sp-yellow); }
html[data-dg-theme="space"] .dg-ten-hero-t { font-family: "Chakra Petch", "Noto Sans JP", sans-serif; }

/* =====================================================================
   選択画面コンポーネント（dg-selector.js）— テーマに関係なく使える
   ===================================================================== */
.dgsel-switch { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.dgsel-switch button { cursor: pointer; padding: 8px 12px; border: 2px solid #11120f; background: #f7f7f0; color: #11120f; font-weight: 800; font-size: .78rem; font-family: inherit;
  clip-path: polygon(7px 0,100% 0,100% calc(100% - 7px),calc(100% - 7px) 100%,0 100%,0 7px); }
.dgsel-switch button.active { background: #ffcc00; }
html[data-dg-theme="space"]:not([data-dg-mode="yellow"]) .dgsel-switch button { background: #242725; color: #f7f7ee; border-color: rgba(255,204,0,.45); }
html[data-dg-theme="space"]:not([data-dg-mode="yellow"]) .dgsel-switch button.active { background: #ffcc00; color: #11120f; }
.dgsel-host { display: block !important; }
.dgsel-stage { position: relative; min-height: 240px; }
.dgsel-arrow { position: absolute; top: 50%; z-index: 5; width: 50px; height: 66px; border: 0; background: #11120f; color: #ffcc00; font-size: 2rem; clip-path: polygon(0 0,75% 0,100% 50%,75% 100%,0 100%,18% 50%); cursor: pointer; }
.dgsel-arrow.prev { left: -12px; transform: translateY(-50%) rotate(180deg); }
.dgsel-arrow.next { right: -12px; transform: translateY(-50%); }
html[data-dg-theme="space"]:not([data-dg-mode="yellow"]) .dgsel-arrow { background: #ffcc00; color: #11120f; }
/* カード（3 層の枠: 外＝黒 / 白い線 / 面） */
.dgsel-pick { position: relative; padding: 5px; background: #11120f; cursor: pointer; clip-path: polygon(14px 0,100% 0,100% calc(100% - 14px),calc(100% - 14px) 100%,0 100%,0 14px); transition: transform .42s cubic-bezier(.2,.8,.2,1), opacity .3s; text-align: left; }
.dgsel-pick:hover { transform: translateY(-4px); }
.dgsel-ring { display: block; height: 100%; padding: 4px; background: #fff; clip-path: polygon(11px 0,100% 0,100% calc(100% - 11px),calc(100% - 11px) 100%,0 100%,0 11px); }
.dgsel-surface { position: relative; display: block; height: 100%; overflow: hidden; background: #f7f7f0; color: #11120f; clip-path: polygon(8px 0,100% 0,100% calc(100% - 8px),calc(100% - 8px) 100%,0 100%,0 8px); }
.dgsel-pick.active .dgsel-surface { background: #171916; color: #f7f7f0; }
.dgsel-pick.active { background: #ffcc00; }
.dgsel-pick.locked { opacity: .7; }
.dgsel-no { position: absolute; z-index: 5; left: 9px; top: 8px; background: #11120f; color: #ffcc00; font-size: 1.2rem; font-weight: 900; padding: 4px 9px; clip-path: polygon(6px 0,100% 0,100% 100%,0 100%,0 6px); }
.dgsel-art { position: relative; display: grid; place-items: center; height: 150px; font-size: 4.5rem; overflow: hidden; border-bottom: 5px solid #11120f;
  background-color: #147ba3; background-image: linear-gradient(120deg,transparent 42%,rgba(255,255,255,.16) 43% 45%,transparent 46%), radial-gradient(circle,rgba(255,255,255,.32) 1px,transparent 1.5px); background-size: 100% 100%, 11px 11px; }
.dgsel-art.dgsel-art-p { background-color: #c2185b; }
.dgsel-art.dgsel-art-g { background-color: #328627; }
.dgsel-art span { filter: drop-shadow(8px 10px 0 rgba(0,0,0,.18)); }
.dgsel-art img { width: 100%; height: 100%; object-fit: cover; }
.dgsel-art-tag { position: absolute; right: 0; bottom: 0; background: #11120f; color: #ffcc00; font-size: .62rem; padding: 5px 9px; }
.dgsel-data { display: block; padding: 8px 12px 14px; }
.dgsel-data small { opacity: .6; font-size: .7rem; }
.dgsel-title { display: block; font-size: 1.35rem; line-height: 1.25; margin: 4px 0; font-weight: 900; }
.dgsel-desc { display: block; font-size: .8rem; line-height: 1.55; margin: 0 0 8px; opacity: .72; }
.dgsel-spec { display: block; height: 8px; background: #cbcdbf; border: 1px solid #11120f; margin: 4px 0 6px; }
.dgsel-spec i { display: block; height: 100%; background: #ffcc00; }
.dgsel-chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0 8px; }
.dgsel-chips em { font: 700 .62rem "Chakra Petch", sans-serif; font-style: normal; border: 1px solid currentColor; padding: 3px 6px; }
.dgsel-go { border: 0; padding: 3px; background: #11120f; cursor: pointer; margin-top: 4px; clip-path: polygon(8px 0,100% 0,100% calc(100% - 8px),calc(100% - 8px) 100%,0 100%,0 8px); font-family: inherit; }
.dgsel-go span { display: block; background: #ffcc00; color: #11120f; font-weight: 900; padding: 9px 16px; clip-path: polygon(6px 0,100% 0,100% calc(100% - 6px),calc(100% - 6px) 100%,0 100%,0 6px); }
.dgsel-go:hover span { background: #ffda33; }
.dgsel-lock { display: inline-block; font-size: .78rem; font-weight: 800; opacity: .8; margin-top: 4px; }
/* 4 画面 */
.dgsel-cards4 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 0 46px; transition: opacity .24s, transform .4s cubic-bezier(.2,.8,.2,1); }
/* 縦スライド */
.dgsel-vertical { height: min(640px, calc(100vh - 260px)); overflow: auto; scroll-snap-type: y mandatory; padding: 60px 12%; scrollbar-width: none; }
.dgsel-vertical::-webkit-scrollbar { display: none; }
.dgsel-vertical .dgsel-pick { scroll-snap-align: center; margin: 20px 0; }
.dgsel-vertical .dgsel-surface { display: grid; grid-template-columns: 42% 1fr; }
.dgsel-vertical .dgsel-art { height: auto; min-height: 240px; border-bottom: 0; border-right: 5px solid #11120f; }
.dgsel-vertical .dgsel-data { align-self: center; }
/* 横スライド */
.dgsel-hstrip { display: flex; gap: 22px; overflow: auto; scroll-snap-type: x mandatory; padding: 40px 50%; scrollbar-width: none; scroll-behavior: smooth; }
.dgsel-hstrip::-webkit-scrollbar { display: none; }
.dgsel-hstrip .dgsel-pick { min-width: 300px; max-width: 300px; scroll-snap-align: center; }
/* 左右選択 */
.dgsel-split { display: grid; grid-template-columns: 300px 1fr; gap: 24px; align-items: start; }
.dgsel-side { display: grid; gap: 10px; max-height: 560px; overflow: auto; scrollbar-width: none; padding: 4px 12px 4px 0; }
.dgsel-side-item { border: 0; padding: 4px; background: #11120f; cursor: pointer; text-align: left; font-weight: 900; font-family: inherit; clip-path: polygon(10px 0,100% 0,100% calc(100% - 10px),calc(100% - 10px) 100%,0 100%,0 10px); transition: transform .2s; }
.dgsel-side-item span { display: block; padding: 13px 15px; background: #f7f7f0; color: #11120f; clip-path: polygon(7px 0,100% 0,100% calc(100% - 7px),calc(100% - 7px) 100%,0 100%,0 7px); }
.dgsel-side-item span::before { content: "◆"; margin-right: 9px; }
.dgsel-side-item.active { transform: translateX(9px); }
.dgsel-side-item.active span { background: #11120f; color: #ffcc00; }
.dgsel-detail, .dgsel-solo { position: relative; display: grid; grid-template-columns: 1.1fr .9fr; min-height: 420px; padding: 4px; background: #ff548f; clip-path: polygon(18px 0,100% 0,100% calc(100% - 18px),calc(100% - 18px) 100%,0 100%,0 18px); box-shadow: 12px 12px 0 #11120f; }
.dgsel-detail::before, .dgsel-solo::before { content: ""; position: absolute; z-index: 0; inset: 3px; background: #11120f; clip-path: polygon(15px 0,100% 0,100% calc(100% - 15px),calc(100% - 15px) 100%,0 100%,0 15px); }
.dgsel-detail > *, .dgsel-solo > * { position: relative; z-index: 1; }
.dgsel-art.big { height: auto; min-height: 380px; font-size: 9rem; border-bottom: 0; background-color: #20305c; background-image: radial-gradient(circle, #27d7ff, #20305c 68%); }
.dgsel-detail-info { padding: 36px; color: #f7f7f0; border-left: 1px solid rgba(255,255,255,.2); }
.dgsel-detail-info h2 { font-size: clamp(1.8rem, 3vw, 2.8rem); margin: 6px 0 10px; }
.dgsel-detail-info p { opacity: .8; line-height: 1.7; }
.dgsel-detail-info small { color: #ffcc00; }
.dgsel-detail-act { margin-top: 18px; }
.dgsel-solo { max-width: 960px; margin: auto; transition: opacity .28s, transform .38s cubic-bezier(.2,.8,.2,1); }
/* 縦一覧 */
.dgsel-list { display: grid; gap: 14px; max-width: 980px; margin: auto; }
.dgsel-reward { position: relative; display: grid; grid-template-columns: 100px 1fr auto; align-items: center; gap: 18px; padding: 4px; background: #11120f; clip-path: polygon(12px 0,100% 0,100% calc(100% - 12px),calc(100% - 12px) 100%,0 100%,0 12px); }
.dgsel-reward::before { content: ""; position: absolute; z-index: 0; inset: 4px; background: #f7f7f0; clip-path: polygon(9px 0,100% 0,100% calc(100% - 9px),calc(100% - 9px) 100%,0 100%,0 9px); }
.dgsel-reward > * { position: relative; z-index: 1; color: #11120f; }
.dgsel-reward .dgsel-mini { margin: 7px; height: 82px; display: grid; place-items: center; font-size: 2.7rem; background: #ffcc00; border: 2px solid #11120f; overflow: hidden; }
.dgsel-reward .dgsel-mini img { width: 100%; height: 100%; object-fit: cover; }
.dgsel-reward h2 { margin: 0; font-size: 1.25rem; }
.dgsel-reward p { margin: 4px 0; font-size: .82rem; opacity: .75; }
.dgsel-reward .dgsel-go, .dgsel-reward .dgsel-lock { margin-right: 10px; }
.dgsel-empty { padding: 30px; text-align: center; opacity: .7; }
/* アニメ */
.dgsel-out-left { opacity: 0; transform: translateX(-48px); }
.dgsel-out-right { opacity: 0; transform: translateX(48px); }
.dgsel-in-left { animation: dgselInL .46s cubic-bezier(.2,.8,.2,1); }
.dgsel-in-right { animation: dgselInR .46s cubic-bezier(.2,.8,.2,1); }
@keyframes dgselInL { from { opacity: 0; transform: translateX(-48px); } to { opacity: 1; transform: none; } }
@keyframes dgselInR { from { opacity: 0; transform: translateX(48px); } to { opacity: 1; transform: none; } }
@media (max-width: 760px) {
  .dgsel-cards4, .dgsel-split, .dgsel-detail, .dgsel-solo { grid-template-columns: 1fr; }
  .dgsel-cards4 { padding: 0 30px; }
  .dgsel-side { grid-template-columns: 1fr 1fr; max-height: none; }
  .dgsel-vertical { padding: 40px 30px; }
  .dgsel-vertical .dgsel-surface { grid-template-columns: 1fr; }
  .dgsel-vertical .dgsel-art { border-right: 0; border-bottom: 5px solid #11120f; min-height: 180px; }
  .dgsel-reward { grid-template-columns: 72px 1fr; }
  .dgsel-reward .dgsel-go, .dgsel-reward .dgsel-lock { grid-column: 2; margin-bottom: 8px; }
  .dgsel-art.big { min-height: 240px; font-size: 6rem; }
}
@media (prefers-reduced-motion: reduce) { .dgsel-pick, .dgsel-cards4, .dgsel-solo { transition: none; } .dgsel-in-left, .dgsel-in-right { animation: none; } }
html[data-dg-theme="space"] .dgs-view-switch { display: flex !important; }
/* トップバーは参考どおり「ロゴ … 切り替え・ログアウト」だけ（名前は おかえり 見出しに出る） */
html[data-dg-theme="space"] .dash-room-title, html[data-dg-theme="space"] .dash-mascot-mini { display: none !important; }
html[data-dg-theme="space"] .dash-header { gap: 12px; }
@media (max-width: 480px) { html[data-dg-theme="space"] .dash-logo { font-size: 1rem; padding-left: 44px; } }
