/* ===== 管理バー（ゲーム外の層。仮想OSとはデザインを分ける） ===== */
:root{
  --mg-bg:#1c1d1f; --mg-fg:#ecebe6; --mg-line:#3a3c40; --mg-accent:#f2c14e;
  --os-font:"Segoe UI Variable Text","Segoe UI","Yu Gothic UI","Meiryo UI",system-ui,sans-serif;
  --win-bg:#f3f3f3; --win-line:#a7adb3; --accent:#0a5fc2;
  --sel:#cce8ff; --sel-line:#99d1ff; --hover:#e5f3ff; --muted:#5f6368;
}
*{box-sizing:border-box}
html,body{margin:0;height:100%;background:#111;overflow:hidden}
body{display:flex;flex-direction:column}
button{font:inherit;color:inherit}

#mgmt{height:36px;flex:none;display:flex;align-items:center;gap:6px;padding:0 10px;
  background:var(--mg-bg);color:var(--mg-fg);border-bottom:2px solid var(--mg-accent);
  font:12.5px/1 "BIZ UDGothic","Yu Gothic UI","Meiryo",sans-serif;user-select:none;position:relative;z-index:20}
.mg-badge{background:var(--mg-accent);color:#1c1d1f;font-weight:700;padding:4px 8px;border-radius:3px;letter-spacing:.04em;white-space:nowrap}
.mg-title{font-weight:700;letter-spacing:.06em;white-space:nowrap}
.mg-spacer{flex:1}
.mg-btn{background:transparent;border:1px solid var(--mg-line);border-radius:4px;padding:6px 10px;cursor:pointer;white-space:nowrap}
.mg-btn:hover{background:#2b2d31}
.mg-btn:focus-visible{outline:2px solid var(--mg-accent);outline-offset:1px}
.mg-toast{color:var(--mg-accent);margin-left:10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:46vw}

/* ゲーム層のモーダル（導入・記録・設定） */
#overlay{position:fixed;inset:0;z-index:50;background:rgba(10,10,12,.72);display:flex;align-items:center;justify-content:center;padding:16px}
#overlay[hidden]{display:none}
.ov-card{background:#fbfaf7;color:#1c1d1f;border-radius:6px;max-width:760px;width:100%;max-height:calc(100vh - 40px);overflow:auto;
  padding:28px 30px;font:14px/1.8 "BIZ UDGothic","Yu Gothic UI","Meiryo",sans-serif;box-shadow:0 20px 60px rgba(0,0,0,.5);border-top:6px solid var(--mg-accent)}
.ov-card h1{font-size:22px;margin:0 0 6px;letter-spacing:.06em}
.ov-card h2{font-size:15px;margin:22px 0 6px;border-bottom:1px solid #ddd;padding-bottom:4px}
.ov-card p{margin:8px 0}
.ov-card .lead{font-size:16px}
.ov-card .note{color:#666;font-size:12.5px}
.ov-actions{display:flex;gap:10px;justify-content:flex-end;margin-top:20px;flex-wrap:wrap}
.ov-btn{border:1px solid #bbb;background:#fff;border-radius:4px;padding:8px 18px;cursor:pointer}
.ov-btn.primary{background:#1c1d1f;color:#fff;border-color:#1c1d1f}
.ov-btn:focus-visible{outline:2px solid var(--mg-accent);outline-offset:2px}
.ov-table{border-collapse:collapse;width:100%;font-size:13px}
.ov-table td,.ov-table th{border-bottom:1px solid #e3e1db;padding:5px 6px;text-align:left;vertical-align:top}
.ov-table th{white-space:nowrap;color:#555;font-weight:600}
.disc-list{list-style:none;padding:0;margin:0;display:grid;grid-template-columns:1fr 1fr;gap:6px 14px;font-size:13px}
.disc-list li{padding:6px 8px;border:1px solid #e3e1db;border-radius:4px;line-height:1.5}
.disc-list li.got{border-color:#1c1d1f;background:#fff}
.disc-list li.no{color:#9a978f}
.disc-id{font-family:Consolas,monospace;font-size:11px;color:#888;margin-right:6px}
.result-wrap canvas{width:100%;height:auto;border:1px solid #ddd;border-radius:4px;display:block}
.set-row{display:flex;align-items:center;gap:10px;margin:10px 0}
.set-row label{min-width:9em}

/* ===== ゲーム内PC ===== */
#game{position:relative;flex:1;overflow:hidden;outline:none;background:#000;isolation:isolate;z-index:0}
#screen{position:absolute;inset:0;overflow:hidden;font:13px/1.35 var(--os-font);color:#1b1b1b;user-select:none;cursor:default}
#wallpaper{position:absolute;inset:0;
  background:
   radial-gradient(60% 70% at 18% 22%, rgba(214,240,222,.95) 0, rgba(214,240,222,0) 60%),
   radial-gradient(55% 60% at 82% 78%, rgba(64,132,140,.85) 0, rgba(64,132,140,0) 65%),
   radial-gradient(40% 50% at 70% 25%, rgba(150,205,190,.8) 0, rgba(150,205,190,0) 70%),
   linear-gradient(140deg,#cfe8da 0%,#8fc4bf 45%,#3f7690 100%)}
#wallpaper::after{content:"";position:absolute;right:9%;top:16%;width:34vmin;height:34vmin;border-radius:0 70% 0 70%;
  border:2px solid rgba(255,255,255,.35);transform:rotate(-18deg)}
#wallpaper::before{content:"";position:absolute;right:calc(9% + 17vmin);top:16%;width:2px;height:48vmin;background:rgba(255,255,255,.25);transform-origin:top;transform:rotate(-63deg)}

#desktop{position:absolute;left:0;top:0;right:0;bottom:48px;padding:6px 4px;outline:none;
  display:grid;grid-auto-flow:column;grid-template-rows:repeat(auto-fill,92px);grid-auto-columns:86px;gap:2px;align-content:start}
#desktop.no-shell{display:none}
.ditem{position:relative;width:82px;height:90px;display:flex;flex-direction:column;align-items:center;gap:3px;padding:5px 2px 2px;
  border:1px solid transparent;border-radius:3px;color:#fff;text-align:center}
.ditem .ico{width:42px;height:42px;position:relative;flex:none}
.ditem .lbl{font-size:12px;line-height:1.3;text-shadow:0 0 3px rgba(0,0,0,.9),0 1px 2px rgba(0,0,0,.7);
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;word-break:break-all;max-width:80px}
.ditem:hover{background:rgba(255,255,255,.14);border-color:rgba(255,255,255,.22)}
.ditem.sel{background:rgba(255,255,255,.3);border-color:rgba(255,255,255,.55)}
.ditem.sel .lbl{-webkit-line-clamp:5}
#desktop:focus .ditem.focus{outline:1px dotted rgba(255,255,255,.9);outline-offset:-2px}
.cut{opacity:.5}
.drop-hover{background:rgba(0,120,215,.28)!important;border-color:rgba(0,120,215,.7)!important}
.ico svg{width:100%;height:100%;display:block}
.ico .lnk{position:absolute;left:-2px;bottom:-2px;width:45%;height:45%}

/* 範囲選択 */
.marquee{position:absolute;border:1px solid #0078d7;background:rgba(0,120,215,.18);pointer-events:none;z-index:5}

/* ===== ウインドウ ===== */
#windows{position:absolute;inset:0;pointer-events:none}
.win{position:absolute;display:flex;flex-direction:column;background:var(--win-bg);pointer-events:auto;
  border:1px solid var(--win-line);border-radius:8px;box-shadow:0 4px 14px rgba(0,0,0,.18);overflow:hidden;min-width:220px}
.win.active{box-shadow:0 10px 32px rgba(0,0,0,.32);border-color:#7d8389}
.win.max{border-radius:0;border-width:0}
.win.minimized{display:none}
.win.dialog{background:#fff;border-radius:8px}
.tb{height:32px;flex:none;display:flex;align-items:center;background:#eef0f2;padding-left:10px;gap:8px}
.win.active .tb{background:#e3e7ea}
.tb .ticon{width:16px;height:16px;flex:none}
.tb .ttl{flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:12px;color:#444}
.win.active .tb .ttl{color:#111}
.tbb{width:46px;height:32px;border:0;background:transparent;display:flex;align-items:center;justify-content:center;cursor:default}
.tbb:hover{background:rgba(0,0,0,.07)}
.tbb.close:hover{background:#c42b1c;color:#fff}
.tbb svg{width:10px;height:10px}
.wbody{flex:1;display:flex;flex-direction:column;min-height:0;position:relative;background:#fff}
.rh{position:absolute;z-index:3}
.rh.n{top:-3px;left:6px;right:6px;height:6px;cursor:ns-resize}
.rh.s{bottom:-3px;left:6px;right:6px;height:6px;cursor:ns-resize}
.rh.e{right:-3px;top:6px;bottom:6px;width:6px;cursor:ew-resize}
.rh.w{left:-3px;top:6px;bottom:6px;width:6px;cursor:ew-resize}
.rh.ne{right:-3px;top:-3px;width:10px;height:10px;cursor:nesw-resize}
.rh.nw{left:-3px;top:-3px;width:10px;height:10px;cursor:nwse-resize}
.rh.se{right:-3px;bottom:-3px;width:12px;height:12px;cursor:nwse-resize}
.rh.sw{left:-3px;bottom:-3px;width:10px;height:10px;cursor:nesw-resize}
.win.max .rh{display:none}
.blocker{position:absolute;inset:0;z-index:50;background:transparent}
.win.flash .tb{animation:flash .12s 3 alternate}
@keyframes flash{to{background:#fff}}

/* ===== ダイアログ ===== */
.dlg{padding:18px 22px 0;display:flex;gap:16px;font-size:13px;background:#fff;flex:1}
.dlg .dico{width:32px;height:32px;flex:none}
.dlg h3{margin:0 0 8px;font-size:15px;font-weight:600;color:#1a3a73}
.dlg p{margin:0 0 8px;white-space:pre-wrap;word-break:break-all}
.dlg .detail{display:flex;gap:10px;align-items:center;margin:8px 0;padding:8px;border:1px solid #e6e6e6;border-radius:4px}
.dlg .detail .ico{width:36px;height:36px;flex:none}
.dlg .detail small{color:#555;display:block;line-height:1.5}
.dlg-cmp{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:8px 0}
.dlg-cmp > div{border:1px solid #e6e6e6;border-radius:4px;padding:8px;line-height:1.55}
.dlg-cmp b{display:block;font-size:12px;color:#1a3a73}
.dlg-foot{display:flex;justify-content:flex-end;gap:8px;padding:14px 16px;background:#f3f3f3;border-top:1px solid #e5e5e5;align-items:center;flex-wrap:wrap}
.dlg-foot label{margin-right:auto;font-size:12px;display:flex;gap:6px;align-items:center}
.btn{min-width:88px;height:30px;padding:0 12px;border:1px solid #c8c8c8;border-radius:4px;background:#fdfdfd;cursor:default}
.btn:hover{background:#f0f0f0}
.btn.default{background:var(--accent);color:#fff;border-color:#08519f}
.btn.default:hover{background:#0b6ad6}
.btn:focus-visible{outline:2px solid #111;outline-offset:1px}
.btn:disabled{opacity:.5}
.field{width:100%;height:30px;border:1px solid #c8c8c8;border-bottom-color:#888;border-radius:4px;padding:0 8px;font:13px var(--os-font);background:#fff}
.field:focus{outline:none;border-bottom:2px solid var(--accent)}
.progress{height:14px;border:1px solid #bbb;border-radius:7px;overflow:hidden;background:#eee;margin:10px 0}
.progress > i{display:block;height:100%;background:#06b025;width:0;transition:width .12s linear}

/* ===== コンテキストメニュー ===== */
#menus{position:absolute;inset:0;pointer-events:none;z-index:9500}
.menu{position:absolute;pointer-events:auto;min-width:210px;background:#f9f9f9;border:1px solid #c6c6c6;border-radius:8px;
  box-shadow:0 8px 24px rgba(0,0,0,.2);padding:4px;font-size:12.5px;outline:none}
.mi{display:flex;align-items:center;gap:10px;height:30px;padding:0 10px;border-radius:4px;white-space:nowrap}
.mi .k{margin-left:auto;color:#777;font-size:11.5px;padding-left:20px}
.mi.bold{font-weight:600}
.mi.on,.mi:hover{background:#e8e8e8}
.mi.dis{color:#aaa;background:none!important}
.msep{height:1px;background:#e0e0e0;margin:4px 6px}

/* ===== タスクバー・スタート ===== */
#taskbar{position:absolute;left:0;right:0;bottom:0;height:48px;z-index:9000;display:flex;align-items:center;justify-content:center;gap:4px;
  background:rgba(236,240,243,.9);backdrop-filter:blur(18px);border-top:1px solid rgba(0,0,0,.1)}
#taskbar.no-shell{display:none}
.tbtn{height:40px;min-width:40px;max-width:170px;padding:0 8px;display:flex;align-items:center;gap:6px;border:0;border-radius:5px;background:transparent;position:relative;cursor:default}
.tbtn:hover{background:rgba(255,255,255,.7)}
.tbtn .ico{width:24px;height:24px;flex:none}
.tbtn .tl{font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tbtn.run::after{content:"";position:absolute;bottom:2px;left:50%;width:6px;height:3px;margin-left:-3px;border-radius:2px;background:#8a8a8a}
.tbtn.act{background:rgba(255,255,255,.85)}
.tbtn.act::after{width:16px;margin-left:-8px;background:var(--accent)}
.tray{position:absolute;right:8px;top:0;bottom:0;display:flex;align-items:center;gap:10px;font-size:12px;text-align:right}
.tray .clock{line-height:1.3}
.tb-sep{width:1px;height:24px;background:rgba(0,0,0,.12);margin:0 4px}
#startmenu{position:absolute;bottom:56px;left:50%;width:560px;max-width:calc(100% - 16px);transform:translateX(-50%);z-index:9100;
  background:rgba(242,244,246,.97);backdrop-filter:blur(20px);border:1px solid #c9ccd0;border-radius:10px;box-shadow:0 14px 40px rgba(0,0,0,.28);padding:22px 26px 0}
#startmenu[hidden]{display:none}
.sm-search{margin-bottom:16px}
.sm-head{font-weight:600;font-size:13px;margin:4px 0 10px}
.sm-grid{display:grid;grid-template-columns:repeat(6,1fr);gap:6px;min-height:170px;align-content:start}
.sm-app{display:flex;flex-direction:column;align-items:center;gap:6px;padding:10px 2px;border-radius:5px;font-size:11.5px;text-align:center;border:0;background:transparent}
.sm-app:hover,.sm-app:focus-visible{background:rgba(255,255,255,.9);outline:none}
.sm-app .ico{width:32px;height:32px}
.sm-foot{display:flex;align-items:center;justify-content:space-between;margin:18px -26px 0;padding:12px 26px;background:rgba(0,0,0,.04);border-top:1px solid #dcdfe2;border-radius:0 0 10px 10px}
.sm-user{display:flex;align-items:center;gap:8px}
.sm-avatar{width:30px;height:30px;border-radius:50%;background:#5c8f7b;color:#fff;display:flex;align-items:center;justify-content:center;font-weight:700}
.sm-power{width:34px;height:34px;border:0;border-radius:5px;background:transparent}
.sm-power:hover{background:rgba(0,0,0,.07)}

/* ===== ファイル管理 ===== */
.ex-tool{display:flex;align-items:center;gap:4px;padding:6px 8px;background:#f7f7f7;border-bottom:1px solid #e6e6e6}
.ib{width:30px;height:28px;border:0;border-radius:4px;background:transparent;display:flex;align-items:center;justify-content:center}
.ib:hover:not(:disabled){background:#e6e6e6}
.ib:disabled{opacity:.35}
.ib svg{width:14px;height:14px}
.ex-addr{flex:1}
.ex-cmd{display:flex;align-items:center;gap:2px;padding:4px 8px;border-bottom:1px solid #e6e6e6;background:#fbfbfb;flex-wrap:wrap}
.cb{height:30px;padding:0 9px;border:0;border-radius:4px;background:transparent;display:flex;align-items:center;gap:6px;font-size:12.5px}
.cb:hover:not(:disabled){background:#ececec}
.cb:disabled{opacity:.38}
.cb svg{width:16px;height:16px}
.cb-sep{width:1px;height:22px;background:#ddd;margin:0 4px}
.ex-main{flex:1;display:flex;min-height:0}
.ex-nav{width:178px;flex:none;border-right:1px solid #ececec;overflow:auto;padding:6px 4px;background:#fff}
.nv{display:flex;align-items:center;gap:7px;height:28px;padding:0 8px;border-radius:4px;white-space:nowrap;overflow:hidden;font-size:12.5px;border:1px solid transparent}
.nv .ico{width:16px;height:16px;flex:none}
.nv:hover{background:#f0f0f0}
.nv.cur{background:#e3eef9}
.nv.sub{padding-left:22px}
.nv-sep{height:1px;background:#eee;margin:6px 4px}
.ex-list{flex:1;overflow:auto;position:relative;outline:none;background:#fff}
.lh{position:sticky;top:0;z-index:2;display:flex;background:#fff;border-bottom:1px solid #eee;height:28px;align-items:center;padding-left:6px}
.lh > div{padding:0 8px;font-size:12px;color:#444;white-space:nowrap;overflow:hidden;border-right:1px solid #eee;height:100%;display:flex;align-items:center}
.lh > div:hover{background:#f3f3f3}
.lr{display:flex;align-items:center;height:28px;margin:0 4px;padding-left:2px;border:1px solid transparent;border-radius:3px;white-space:nowrap}
.lr > div{padding:0 8px;overflow:hidden;text-overflow:ellipsis;font-size:12.5px}
.lr .c-name{display:flex;align-items:center;gap:7px}
.lr .ico{width:18px;height:18px;flex:none;position:relative}
.lr .c-dim{color:#666}
.lr:hover{background:var(--hover)}
.lr.sel{background:var(--sel);border-color:var(--sel-line)}
.ex-list:focus .lr.focus{outline:1px dotted #333;outline-offset:-2px}
.c-name{width:var(--w-name,280px);flex:none}
.c-a{width:150px;flex:none}
.c-b{width:130px;flex:none}
.c-c{width:90px;flex:none;text-align:right;justify-content:flex-end}
.lr .c-c{text-align:right}
.ex-empty{color:#777;text-align:center;padding:30px;font-size:12.5px}
.ex-status{height:24px;flex:none;display:flex;align-items:center;gap:16px;padding:0 12px;font-size:12px;color:#444;border-top:1px solid #eee;background:#fff}
.drives{display:flex;flex-wrap:wrap;gap:10px;padding:14px}
.drv{width:260px;display:flex;gap:10px;align-items:center;padding:8px;border:1px solid transparent;border-radius:4px}
.drv .ico{width:40px;height:40px;flex:none}
.drv .bar{height:12px;background:#e6e6e6;border:1px solid #bbb;margin:4px 0}
.drv .bar i{display:block;height:100%;background:#26a0da}
.drv .bar i.full{background:#da2626}
.drv small{color:#666}
.drv:hover{background:var(--hover)}
.drv.sel{background:var(--sel);border-color:var(--sel-line)}
.rn{position:absolute;z-index:4;height:24px;font:12.5px var(--os-font);border:1px solid #0078d7;padding:0 4px;outline:none;background:#fff;color:#000}
.ditem .rn{position:static;width:84px;height:auto;min-height:20px;text-align:center;resize:none;overflow:hidden;font-size:12px}

/* ===== テキスト編集 ===== */
.ed-menu{display:flex;gap:2px;padding:4px 6px;background:#f7f7f7;border-bottom:1px solid #e6e6e6}
.ed-mb{height:28px;padding:0 10px;border:0;border-radius:4px;background:transparent;font-size:12.5px}
.ed-mb:hover,.ed-mb.on{background:#e6e6e6}
.ed-area{flex:1;border:0;outline:none;resize:none;padding:16px 22px;font:15px/1.75 "Yu Gothic UI","Meiryo UI","BIZ UDGothic",sans-serif;color:#111;
  background:#fff;white-space:pre-wrap;user-select:text;cursor:text}
.ed-area::selection{background:#bcd8f5}
.ed-status{height:26px;flex:none;display:flex;align-items:center;gap:0;font-size:12px;color:#444;border-top:1px solid #eee;background:#f7f7f7}
.ed-status > span{padding:0 12px;border-right:1px solid #e1e1e1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ed-status > span:last-child{border-right:0}
.ed-status .flag{color:#8a4b00}

/* ===== 写真 ===== */
.ph{flex:1;display:flex;align-items:center;justify-content:center;background:#202020;min-height:0;color:#ddd;font-size:13px;padding:10px;text-align:center}
.ph canvas{max-width:100%;max-height:100%}

/* ===== タスク管理 ===== */
.tm-head{display:flex;align-items:center;gap:8px;padding:8px 12px;border-bottom:1px solid #e6e6e6;background:#f7f7f7}
.tm-head b{font-size:14px;flex:1}
.tm-list{flex:1;overflow:auto;outline:none}
.tm-row{display:flex;align-items:center;height:28px;padding:0 10px;border-bottom:1px solid #f2f2f2;white-space:nowrap}
.tm-row > div{overflow:hidden;text-overflow:ellipsis;font-size:12.5px}
.tm-row .n{flex:1;display:flex;align-items:center;gap:8px}
.tm-row .n .ico{width:16px;height:16px;flex:none}
.tm-row .s{width:80px;color:#666}
.tm-row .c{width:56px;text-align:right}
.tm-row .m{width:86px;text-align:right}
.tm-row:hover{background:var(--hover)}
.tm-row.sel{background:var(--sel)}
.tm-grp{padding:10px 10px 4px;font-weight:600;font-size:12.5px;color:#333}
.tm-th{position:sticky;top:0;background:#fff;border-bottom:1px solid #ddd;color:#555;font-weight:600}
.tm-th:hover{background:#fff}
.tm-foot{display:flex;justify-content:flex-end;gap:8px;padding:8px 12px;border-top:1px solid #e6e6e6;background:#f7f7f7}

/* ===== ドラッグ表示・起動画面 ===== */
#dragghost{position:absolute;z-index:9800;pointer-events:none;display:flex;align-items:flex-start;gap:4px}
#dragghost[hidden]{display:none}
#dragghost .gi{width:44px;height:44px;opacity:.75;position:relative}
#dragghost .gc{position:absolute;right:-6px;top:-6px;background:var(--accent);color:#fff;border-radius:9px;font-size:11px;padding:1px 6px}
#dragghost .gb{margin-top:34px;background:#fff;border:1px solid #bbb;border-radius:3px;padding:2px 7px;font-size:12px;white-space:nowrap;box-shadow:0 2px 6px rgba(0,0,0,.2)}
#dragghost .gb.no{color:#999}
#boot{position:absolute;inset:0;z-index:9900;background:#000;color:#ddd;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:22px;font-size:15px}
#boot[hidden]{display:none}
.boot-logo{width:70px;height:70px}
.spin{width:30px;height:30px;border-radius:50%;border:3px solid rgba(255,255,255,.2);border-top-color:#fff;animation:sp 1s linear infinite}
@keyframes sp{to{transform:rotate(360deg)}}
.boot-btn{background:transparent;border:1px solid #666;color:#eee;border-radius:50%;width:64px;height:64px;font-size:22px;cursor:pointer}
.boot-btn:hover{background:#222}
.rs-panel{background:#0b3f73;position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;color:#fff}
.rs-panel ul{margin:0;padding:0;list-style:none;min-width:320px}
.rs-panel li{display:flex;align-items:center;gap:10px;padding:8px 10px;background:rgba(255,255,255,.08);margin:4px 0}
.rs-panel .ico{width:24px;height:24px}
.rs-panel .btn{min-width:150px}

@media (max-width:760px){
  .mg-title{display:none}
  .mg-btn{padding:6px 6px}
  .ex-nav{display:none}
}
.drives .lh{width:100%}

