:root {
  --navy: #1c2a5e;
  --navy2: #2a4aa0;
  --ink: #2a2440;
  --sky: #6ab8ff;
  --btn1: #ece8ff;
  --btn2: #c8c0f0;
  --font: "DotGothic16", "MS Gothic", "MS UI Gothic", "Yu Gothic UI", monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: #0e1636; color: #fff; font-family: var(--font); overflow: hidden; }
button { font-family: var(--font); color: var(--navy); background: linear-gradient(#f4f1ff, #cfc7f2); border: 2px solid var(--ink); border-radius: 8px; padding: 4px 10px; cursor: pointer; box-shadow: 0 3px 0 #2a2a5a; font-size: 14px; }
button:hover:not(:disabled) { background: linear-gradient(#ffffff, #dcd6ff); }
button:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #2a2a5a; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.danger { color: #b02020; }
button.on { background: linear-gradient(#ffe680, #ffc020); }
small { font-size: 11px; }

#frame { position: relative; width: 100vw; height: 100vh; overflow: hidden; }
#stage { position: absolute; left: 0; top: 0; width: 1280px; height: 660px; transform-origin: 0 0; background: #6ab8ff; }
#game { position: absolute; left: 0; top: 0; width: 1280px; height: 660px; image-rendering: pixelated; image-rendering: crisp-edges; display: block; }

/* ---- 上のバー ---- */
#topbar { position: absolute; left: 0; top: 0; width: 1280px; height: 46px; background: linear-gradient(#6f9cf0, #3e6ad4); border-bottom: 3px solid var(--navy); box-shadow: inset 0 2px 0 rgba(255,255,255,0.35); display: flex; align-items: center; justify-content: space-between; padding: 0 12px; }
.tb-left, .tb-right { display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; background: linear-gradient(#ffffff, #cfe0ff); border: 2px solid var(--navy); border-radius: 6px; position: relative; }
.avatar i { position: absolute; left: 11px; top: 6px; width: 12px; height: 10px; background: #ffd9b8; border: 2px solid var(--ink); border-radius: 3px; box-shadow: 0 12px 0 -2px #4a8ee8; }
.daybox { background: var(--navy); border: 2px solid #0e1636; border-radius: 6px; padding: 2px 10px; color: #ffe680; display: flex; align-items: baseline; gap: 4px; text-shadow: 1px 1px 0 #000; }
.daybox b { font-size: 26px; font-weight: normal; color: #fff; }
.daybox span { font-size: 14px; color: #ffe680; }
.daybox small { font-size: 12px; color: #a8c0ff; }
.sun { width: 22px; height: 22px; border-radius: 50%; background: #ffe060; box-shadow: 0 0 0 3px #ffb020, 0 0 0 5px rgba(255,255,255,0.4); }
.sun.evening { background: #ff9040; box-shadow: 0 0 0 3px #e06020, 0 0 0 5px rgba(255,255,255,0.4); }
.daybar { width: 120px; height: 10px; background: #1c2a5e; border: 2px solid #0e1636; border-radius: 4px; overflow: hidden; }
.daybar i { display: block; height: 100%; width: 0; background: linear-gradient(#ffe680, #ffb020); }
.speed { display: flex; gap: 3px; }
.speed button { padding: 2px 8px; font-size: 12px; box-shadow: 0 2px 0 #2a2a5a; }
.money { font-size: 28px; color: #fff; text-shadow: 2px 2px 0 var(--navy), -1px -1px 0 var(--navy), 1px -1px 0 var(--navy), -1px 1px 0 var(--navy); min-width: 200px; text-align: right; letter-spacing: 1px; }
.money.neg { color: #ff8080; }

/* ---- 注目 ---- */
#notice { position: absolute; right: 12px; top: 54px; display: flex; align-items: center; gap: 8px; background: linear-gradient(#f8e8ff, #e0c8ff); border: 3px solid #7a4ad8; border-radius: 10px; padding: 4px 12px 4px 6px; color: var(--navy); font-size: 15px; box-shadow: 0 3px 0 #3a2a6a; max-width: 460px; animation: notice-in 0.3s ease; }
@keyframes notice-in { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }
.nt-face { width: 30px; height: 30px; background: #ffffff; border: 2px solid var(--ink); border-radius: 6px; position: relative; }
.nt-face i { position: absolute; left: 9px; top: 4px; width: 10px; height: 9px; background: #ffd9b8; border: 2px solid var(--ink); border-radius: 3px; box-shadow: 0 11px 0 -2px #e85d5d; }
.nt-label { background: #7a4ad8; color: #fff; padding: 1px 8px; border-radius: 6px; font-size: 14px; }

/* ---- ログ ---- */
#log { position: absolute; left: 8px; bottom: 76px; width: 300px; pointer-events: none; font-size: 12px; line-height: 1.3; }
#log .l { background: rgba(16,26,66,0.82); border: 2px solid #4a6ad0; border-radius: 6px; padding: 2px 8px; margin-top: 4px; color: #fff; animation: fadein 0.3s ease; text-shadow: 1px 1px 0 #000; }
#log .l.big { border-color: #ffd020; color: #ffe680; }
#log .l.rev { border-color: #ff5050; color: #ffb0b0; }
#log .l.warn { border-color: #ff9040; color: #ffd0a0; }
#log .l.wave { border-color: #f0a020; color: #ffe0a0; }
#log .l.day { border-color: #60d080; color: #c0ffd0; }
#log .l.build { border-color: #8fb4ff; }
#log .l.cheap { color: #b8c0d8; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

#modeHint { position: absolute; top: 56px; left: 50%; transform: translateX(-50%); background: linear-gradient(#ffe680, #ffc020); border: 3px solid var(--ink); border-radius: 8px; padding: 6px 14px; color: var(--ink); font-size: 15px; box-shadow: 0 3px 0 #2a2a5a; pointer-events: none; }

/* ---- ツールチップ ---- */
#tip { position: absolute; z-index: 20; pointer-events: none; background: rgba(16,26,66,0.95); border: 3px solid #8fb4ff; border-radius: 8px; padding: 6px 10px; font-size: 13px; max-width: 330px; box-shadow: 0 4px 0 #0e1636; line-height: 1.45; color: #fff; }
#tip .th { display: flex; align-items: center; gap: 6px; font-size: 14px; border-bottom: 1px dashed #4a6ad0; padding-bottom: 3px; margin-bottom: 3px; }
#tip .th .yen { margin-left: auto; color: #ffe680; }
#tip .tr { color: #dfe8ff; }
#tip .tr.warn { color: #ffb0b0; }
.sw { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 3px; border: 1px solid var(--ink); color: #fff; font-size: 10px; flex: 0 0 auto; }

/* ---- ポップオーバー ---- */
#pop { position: absolute; z-index: 15; width: 290px; background: rgba(16,26,66,0.96); border: 3px solid #8fb4ff; border-radius: 10px; box-shadow: 0 4px 0 #0e1636; overflow: hidden; color: #fff; }
#pop .ph { display: flex; align-items: center; padding: 6px 10px; border-bottom: 2px solid #8fb4ff; font-size: 15px; color: var(--ink); }
#pop .ph .x, #panel .x, #menu .x { margin-left: auto; cursor: pointer; font-size: 18px; line-height: 1; padding: 0 4px; }
#pop .pb { padding: 8px 10px; font-size: 13px; }
#pop .desc { color: #bfd0ff; margin-bottom: 4px; }
#pop .row { margin: 2px 0; }
#pop .row .warn { color: #ff8080; }
#pop .btns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
#pop .btns button { font-size: 13px; padding: 5px 4px; }
#pop .bgrid { display: grid; grid-template-columns: 1fr; gap: 4px; max-height: 380px; overflow: auto; }
#pop .bb { display: flex; align-items: center; gap: 8px; text-align: left; font-size: 13px; padding: 5px 8px; }
#pop .bb em { margin-left: auto; font-style: normal; color: #1a7a30; }

/* ---- 下のバー ---- */
#bottombar { position: absolute; left: 0; bottom: 0; width: 1280px; height: 68px; background: linear-gradient(#5b86e0, #2f4fb0); border-top: 3px solid var(--navy); box-shadow: inset 0 2px 0 rgba(255,255,255,0.35); display: flex; align-items: center; justify-content: space-between; padding: 0 12px; }
.bigbtn { width: 150px; height: 48px; font-size: 22px; border-radius: 12px; border: 3px solid #2a2a5a; box-shadow: 0 4px 0 #1c1c4a; background: linear-gradient(#efeaff, #c4b8f0); letter-spacing: 2px; }
.bigbtn.on { background: linear-gradient(#ffe680, #ffc020); }
.status { flex: 1; margin: 0 14px; background: var(--navy); border: 2px solid #0e1636; border-radius: 8px; padding: 3px 10px; display: flex; flex-direction: column; gap: 2px; }
.st-row { display: flex; gap: 18px; align-items: center; }
.st { display: flex; align-items: center; gap: 6px; font-size: 20px; color: #fff; text-shadow: 1px 1px 0 #000; }
.st small { color: #ff9090; font-size: 11px; }
.ic { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--ink); border-radius: 4px; }
.ic-person { background: #ffd9b8; box-shadow: inset 0 -6px 0 #4a8ee8; }
.ic-card { background: #fff3c4; box-shadow: inset 0 -4px 0 #f2a030; }
.ic-queue { background: #ffe680; border-radius: 50%; }
.ic-rev { background: #ff5050; }
.ic-rest { background: #60d080; }
.st-row2 { display: flex; gap: 10px; }
.box { font-size: 13px; padding: 1px 8px; border-radius: 4px; color: #fff; }
.box.blue { background: #3a5ac0; }
.box.blue2 { background: #4a7ad8; }
.box b { font-size: 16px; color: #ffe680; }

/* ---- メニュー ---- */
#menu { position: absolute; right: 12px; bottom: 76px; width: 200px; background: rgba(16,26,66,0.96); border: 3px solid #8fb4ff; border-radius: 10px; padding: 8px; display: flex; flex-direction: column; gap: 6px; box-shadow: 0 4px 0 #0e1636; z-index: 14; }
#menu .mtitle { color: #fff; text-align: center; font-size: 14px; border-bottom: 1px dashed #4a6ad0; padding-bottom: 4px; }
#menu button { font-size: 15px; }

/* ---- 経営手帳 ---- */
#panel { position: absolute; right: 12px; top: 54px; bottom: 76px; width: 350px; background: rgba(16,26,66,0.96); border: 3px solid #8fb4ff; border-radius: 12px; box-shadow: 0 4px 0 #0e1636; z-index: 12; display: flex; flex-direction: column; overflow: hidden; color: #fff; }
#panel .pt { display: flex; align-items: center; padding: 8px 12px; background: var(--navy2); border-bottom: 2px solid #8fb4ff; font-size: 16px; }
#panel .tabs { display: flex; gap: 4px; padding: 6px 8px 0; border-bottom: 2px solid #8fb4ff; background: #16224e; }
#panel .tab { border-bottom: none; border-radius: 8px 8px 0 0; box-shadow: none; padding: 5px 12px; background: #c0c8e8; }
#panel .tab.on { background: linear-gradient(#ffe680, #ffc020); position: relative; top: 2px; }
#panel .tabpage { padding: 8px 12px 12px; overflow: auto; flex: 1 1 auto; font-size: 14px; }
#panel h4 { margin: 8px 0 6px; font-size: 14px; color: #ffe680; border-bottom: 1px dashed #4a6ad0; padding-bottom: 2px; }
#panel .chk { display: flex; align-items: center; gap: 6px; padding: 3px 2px; cursor: pointer; }
#panel .chk em { margin-left: auto; font-style: normal; font-size: 11px; color: #bfd0ff; }
#panel select { font-family: var(--font); font-size: 14px; padding: 4px 6px; border: 2px solid var(--ink); border-radius: 6px; background: #fff; color: var(--navy); width: 100%; }
#panel .memo { font-size: 12px; color: #dfe8ff; background: rgba(255,255,255,0.08); border-radius: 6px; padding: 6px 8px; margin: 8px 0 0; }
#panel .seg { display: flex; gap: 4px; }
#panel .seg button { flex: 1; font-size: 13px; padding: 5px 2px; }
#panel .info { line-height: 1.6; }
#panel .btns { display: flex; gap: 6px; margin-top: 8px; }
#panel .brow { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px dotted #4a6ad0; }
#panel .brow .sw { width: 14px; height: 14px; }
#panel .brow .bn { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
#panel .brow .bn small { font-size: 11px; color: #bfd0ff; }
#panel .brow .own { font-size: 11px; color: #bfd0ff; white-space: nowrap; }
#panel .brow button { font-size: 12px; padding: 3px 6px; white-space: nowrap; }

/* ---- タイトル・決算 ---- */
#title, #report { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: linear-gradient(#5aa8ff, #cfeaff 60%, #7fb46a 60%, #6fa45a); overflow: auto; }
.tsheet { background: rgba(16,26,66,0.92); border: 4px solid #8fb4ff; border-radius: 16px; padding: 28px 36px; max-width: 680px; width: calc(100% - 40px); box-shadow: 0 6px 0 #0e1636; text-align: center; }
.tlogo { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 8px; }
.tlogo .ai { font-size: 40px; color: #fff; background: #e83c3c; border: 4px solid #fff; border-radius: 10px; padding: 0 14px; box-shadow: 0 4px 0 #7a1f18; transform: rotate(-6deg); }
.tlogo .tt { font-size: 56px; color: #ffe680; text-shadow: 3px 3px 0 var(--navy), -2px -2px 0 var(--navy), 2px -2px 0 var(--navy), -2px 2px 0 var(--navy); letter-spacing: 4px; }
.tsub { font-size: 18px; margin: 4px 0 12px; color: #fff; }
.tdesc { font-size: 14px; color: #dfe8ff; line-height: 1.8; margin: 0 0 18px; }
#startBtn, #againBtn { font-size: 24px; padding: 10px 32px; border: 3px solid #2a2a5a; border-radius: 12px; box-shadow: 0 5px 0 #1c1c4a; background: linear-gradient(#ffe680, #ffc020); }
.tkeys { font-size: 12px; color: #bfd0ff; margin-top: 18px; }

.rsheet { background: rgba(16,26,66,0.95); border: 4px solid #8fb4ff; border-radius: 16px; padding: 22px 30px; max-width: 760px; width: calc(100% - 40px); box-shadow: 0 6px 0 #0e1636; text-align: left; max-height: calc(100vh - 30px); overflow: auto; color: #fff; }
#report h2 { text-align: center; margin: 0 0 12px; font-size: 26px; letter-spacing: 3px; color: #ffe680; text-shadow: 2px 2px 0 #000; }
#report table { width: 100%; border-collapse: collapse; font-size: 14px; }
#report th { text-align: left; font-weight: normal; padding: 4px 6px; border-bottom: 1px dotted #4a6ad0; color: #bfd0ff; width: 62%; }
#report td { text-align: right; padding: 4px 6px; border-bottom: 1px dotted #4a6ad0; color: #fff; font-variant-numeric: tabular-nums; }
#report tr.good td { color: #a0ffb0; }
#report tr.bad td { color: #ff9090; }
#report .mix { font-size: 12px; color: #bfd0ff; margin: 10px 0 14px; line-height: 1.6; }
#credit { opacity: 0; transform: translateY(6px); transition: opacity 1.2s ease, transform 1.2s ease; text-align: center; border-top: 2px solid #8fb4ff; padding-top: 14px; }
#credit.show { opacity: 1; transform: none; }
#credit p { font-size: 16px; line-height: 1.7; margin: 0 0 8px; color: #ffe680; }
#credit p.small { font-size: 12px; color: #bfd0ff; margin-bottom: 14px; }
