/* Lets 経営しよう — web prototype. Stage designed at 1280x720 and scaled to the window (letterbox).
   Palette: spec/04_演出と素材.md §4. */
:root {
  --c-bg: #84D1C9;
  --c-panel: #C2E8E4;
  --c-panel-light: #DAF1EF;
  --c-label: #DFF2F0;
  --c-band: #B4DEDA;
  --c-accent: #09B2A8;
  --c-teal-700: #2A6E66;
  --c-teal-600: #3A9E93;
  --c-teal-800: #205850;
  --c-link: #1212CD;
  --c-hover-exec: #FF8C00;
  --c-hover-close: #1E90FF;
  --c-penalty: #FFD9D9;
  --c-gameover: #B6CAFF;
  --c-gameclear: #FFDEDE;
  --c-cash: #FFA532;
  --c-sales: #48C096;
  --c-expense: #8CD2E6;
  --c-profit: #E6C828;
  --c-text: #0F172A;
  --c-warn: #E8524A;
  --c-yellow: #FFE84D;
  --font: "Noto Sans JP", "Yu Gothic UI", "Meiryo", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #163f3b; font-family: var(--font); color: var(--c-text); }
#viewport { position: fixed; inset: 0; }
#stage {
  position: absolute; left: 0; top: 0; width: 1280px; height: 720px; transform-origin: 0 0; overflow: hidden;
  background: var(--c-bg) url("/assets/CompMng.Resources/main_back.png") 0 0 / 1280px 720px no-repeat;
  font-size: 16px; user-select: none;
}
#screen { position: absolute; inset: 0; }
#overlay { position: absolute; inset: 0; pointer-events: none; }
#overlay > * { pointer-events: auto; }
button, input, select { font-family: var(--font); font-size: 16px; }
input[type=text], input[type=password], input[type=number], select {
  border: 2px solid var(--c-band); border-radius: 6px; padding: 6px 10px; background: #fff; color: var(--c-text); user-select: text;
}
input:focus, select:focus, button:focus-visible { outline: 3px solid var(--c-hover-exec); outline-offset: 1px; }

/* panels: 5px chamfered octagon like the original Region */
.panel { background: var(--c-panel); clip-path: polygon(5px 0, calc(100% - 5px) 0, 100% 5px, 100% calc(100% - 5px), calc(100% - 5px) 100%, 5px 100%, 0 calc(100% - 5px), 0 5px); }
.abs { position: absolute; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 128px; height: 38px; padding: 0 18px;
  border: 2px solid #fff; border-radius: 999px; background: #fff; color: #222; font-weight: 700; cursor: pointer;
  box-shadow: 0 3px 0 rgba(32, 88, 80, .35); transition: transform .05s, color .1s;
}
.btn:hover { color: var(--c-hover-exec); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(32, 88, 80, .35); }
.btn.primary { background: linear-gradient(#FFE84D, #F5C000); border-color: #DCB000; color: #4A3000; }
.btn.primary:hover { color: #A05C00; }
.btn.close { background: #fff; }
.btn.close:hover { color: var(--c-hover-close); }
.btn.danger { background: #FF6666; border-color: #F9908F; color: #fff; }
.btn[disabled] { opacity: .4; cursor: default; transform: none; }
.btn.small { min-width: 80px; height: 30px; font-size: 14px; padding: 0 12px; }
.link { color: var(--c-link); text-decoration: underline; cursor: pointer; background: none; border: 0; padding: 0; }
.link:hover { color: var(--c-hover-close); }

/* radios like C00011/C00013 */
.choices { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.choice {
  display: flex; align-items: center; gap: 10px; padding: 6px 10px; background: #fff; border: 2px solid var(--c-band); border-radius: 8px; cursor: pointer; text-align: left;
  font-weight: 500;
}
.choice::before { content: ""; width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--c-band); flex: none; background: #fff; }
.choice.sel { border-color: #E88F00; background: #FFF3D6; }
.choice.sel::before { border-color: #E88F00; background: radial-gradient(circle, #E88F00 45%, #fff 50%); }
.choice:hover { border-color: #F5A623; }

/* toast */
#toast {
  position: absolute; left: 50%; top: 60px; transform: translateX(-50%); min-width: 360px; max-width: 900px; padding: 12px 24px; border-radius: 10px;
  background: rgba(32, 88, 80, .94); color: #fff; font-weight: 700; text-align: center; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 100; white-space: pre-line;
}
#toast.show { opacity: 1; }
#toast.error { background: rgba(200, 40, 40, .94); }

/* modal */
.modal-back { position: absolute; inset: 0; background: rgba(10, 40, 36, .45); display: flex; align-items: center; justify-content: center; z-index: 20; }
.modal { position: relative; background: var(--c-panel); border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); padding: 24px 32px; max-width: 1220px; max-height: 690px; display: flex; flex-direction: column; }
.modal h2 { margin: 0 0 12px; font-size: 26px; color: var(--c-teal-700); font-weight: 900; text-align: center; }
.modal .body { overflow: auto; flex: 1; min-height: 0; }
.modal .buttons { display: flex; gap: 16px; justify-content: center; margin-top: 16px; flex: none; }
.modal.penalty { background: var(--c-penalty); }
.modal.big { width: 1220px; height: 680px; }
.modal.mid { width: 960px; }
.modal.small { width: 620px; }
.modal .note { color: var(--c-teal-700); font-size: 14px; }
.err { color: var(--c-warn); font-weight: 700; font-size: 14px; min-height: 1em; white-space: pre-line; }
.with-pic { display: flex; gap: 24px; align-items: flex-start; }
.with-pic .pic { width: 290px; height: 350px; flex: none; }
.with-pic .pic img { width: 100%; height: 100%; object-fit: contain; }
.with-pic .txt { flex: 1; font-size: 18px; line-height: 1.7; }
.msg { white-space: pre-line; font-size: 18px; line-height: 1.7; }

/* tables */
table.grid { border-collapse: collapse; width: 100%; background: #fff; font-size: 14px; }
table.grid th, table.grid td { border: 1px solid #C8EAE6; padding: 3px 7px; }
table.grid th { background: #D4EEEA; color: var(--c-teal-700); font-weight: 700; position: sticky; top: 0; z-index: 1; }
table.grid td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.grid td.lbl { background: #EAF7F5; font-weight: 700; white-space: nowrap; }
table.grid td.sub { background: #EAF7F5; color: #4A8E88; white-space: nowrap; }
table.grid tr:hover td { background: #FFE0B2; }
table.grid td.none { color: #C0DCD8; text-align: center; }
table.grid tr.total td { font-weight: 900; border-top: 2px solid #8CCCC5; }
table.grid tr.selrow td { background: #FFF3D6; }
.neg { color: var(--c-warn); }

/* ---------------- login ---------------- */
.login { position: absolute; inset: 0; background: url("/assets/CompMng.Resources/login_background.png") 0 0 / 1280px 720px no-repeat; }
.login .title { position: absolute; left: 265px; top: 20px; width: 750px; height: 138px; }
.login .box { position: absolute; left: 290px; top: 300px; width: 700px; padding: 26px 40px; background: rgba(194, 232, 228, .96); border-radius: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); }
.login .tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.login .tabs button { flex: 1; height: 40px; border: 0; border-radius: 8px; background: var(--c-band); font-weight: 700; cursor: pointer; color: var(--c-teal-700); }
.login .tabs button.on { background: var(--c-accent); color: #fff; }
.form-row { display: flex; align-items: center; gap: 12px; margin: 10px 0; }
.form-row label { width: 180px; font-weight: 700; color: var(--c-teal-700); }
.form-row input { flex: 1; }
.form-row .hint { font-size: 13px; color: var(--c-teal-700); }

/* ---------------- wizard ---------------- */
.wizard { position: absolute; inset: 0; }
.wizard .head { position: absolute; left: 40px; top: 18px; right: 40px; display: flex; align-items: center; justify-content: space-between; }
.wizard .head h1 { margin: 0; font-size: 34px; font-weight: 900; color: #fff; text-shadow: 0 2px 0 var(--c-teal-700); }
.steps { display: flex; gap: 6px; }
.steps span { padding: 4px 14px; border-radius: 999px; background: rgba(255, 255, 255, .5); color: var(--c-teal-700); font-size: 14px; font-weight: 700; }
.steps span.on { background: var(--c-hover-exec); color: #fff; }
.wizard .main { position: absolute; left: 40px; top: 80px; width: 1200px; height: 560px; padding: 22px 30px; overflow: auto; }
.wizard .foot { position: absolute; left: 40px; right: 40px; bottom: 18px; display: flex; justify-content: center; gap: 20px; }
.course { display: flex; gap: 20px; margin-top: 10px; }
.course .card { flex: 1; padding: 16px 20px; background: #fff; border: 3px solid var(--c-band); border-radius: 12px; cursor: pointer; }
.course .card.sel { border-color: #E88F00; background: #FFF3D6; }
.course .card h3 { margin: 0 0 6px; color: var(--c-teal-700); }
.offices { max-height: 330px; overflow: auto; }
.cols { display: flex; gap: 24px; }
.cols > * { flex: 1; min-width: 0; }
.staff-table td input { width: 90px; text-align: right; }
.staff-table td select { width: 70px; }
.kv { display: grid; grid-template-columns: auto auto; gap: 4px 16px; font-size: 15px; }
.kv .v { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.profit-box { margin-top: 10px; padding: 10px 16px; border-radius: 10px; background: #fff; font-size: 18px; font-weight: 900; text-align: center; }
.profit-box.ng { background: #FFDEDE; color: var(--c-warn); }

/* ---------------- main screen ---------------- */
.topbar { position: absolute; left: 0; top: 0; width: 1280px; height: 45px; display: flex; gap: 4px; padding: 0 4px; }
.topbar button {
  flex: 1; height: 40px; border: 1px solid #A8DDD7; border-top: 0; border-radius: 0 0 12px 12px; background: #fff; box-shadow: 0 4px 0 #5FA79E;
  font-weight: 700; color: var(--c-teal-700); cursor: pointer; font-size: 15px; position: relative;
}
.topbar button:hover { color: var(--c-hover-exec); }
.topbar button .badge { position: absolute; right: 8px; top: 4px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--c-warn); color: #fff; font-size: 11px; line-height: 18px; }
.topbar button.end { flex: 0 0 90px; color: #777; }
.stagepanel { position: absolute; left: 8px; top: 56px; width: 760px; height: 420px; }
.animbox { position: absolute; left: 6px; top: 5px; width: 344px; height: 410px; overflow: hidden; border-radius: 4px; }
.topicarea { position: absolute; left: 360px; top: 8px; width: 392px; height: 404px; display: flex; flex-direction: column; }
.topicarea .tag { align-self: flex-start; padding: 2px 12px; border-radius: 999px; background: var(--c-accent); color: #fff; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.topicarea .tag.penalty { background: var(--c-warn); }
.topicarea .text { flex: 1; overflow: auto; font-size: 17px; line-height: 1.65; white-space: pre-line; background: #fff; border-radius: 8px; padding: 10px 14px; }
.topicarea .text .ymline { font-size: 14px; color: var(--c-teal-700); font-weight: 700; }
.topicarea .choices .choice { padding: 4px 10px; font-size: 15px; }
.topicarea .btns { display: flex; justify-content: flex-end; gap: 12px; margin-top: 8px; }
.infolog { position: absolute; left: 8px; top: 486px; width: 760px; height: 226px; background: var(--c-bg); border: 3px solid var(--c-panel); border-radius: 8px; overflow: auto; padding: 6px 10px; font-size: 14px; }
.infolog div { padding: 2px 0; border-bottom: 1px dashed rgba(255, 255, 255, .45); user-select: text; }
.infolog .k-warn { color: #9a0000; font-weight: 700; }
.infolog .k-penalty { color: #9a0000; }
.infolog .k-month { color: #fff; font-weight: 900; text-shadow: 0 1px 0 var(--c-teal-700); }
.infolog .k-season { color: var(--c-teal-800); }
.infolog .ym { color: var(--c-teal-800); font-size: 12px; margin-right: 6px; }
.side { position: absolute; left: 780px; top: 52px; width: 492px; }
.plate { height: 58px; background: url("/assets/CompMng.Resources/MainCompName.png") 0 0 / 477px 58px no-repeat; display: flex; align-items: center; padding: 0 22px 0 52px; justify-content: space-between; }
.plate .name { font-size: 24px; font-weight: 900; color: var(--c-teal-700); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 330px; }
.plate .course { font-size: 13px; padding: 2px 10px; border-radius: 999px; background: var(--c-accent); color: #fff; margin-right: 10px; }
.dateline { display: flex; align-items: center; gap: 8px; margin: 4px 0; font-size: 20px; font-weight: 900; color: #fff; text-shadow: 0 2px 0 var(--c-teal-700); }
.dateline img { width: 30px; }
.counters { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.counter { background: rgba(255, 255, 255, .85); border-radius: 10px; padding: 4px 8px; text-align: center; }
.counter .lbl { font-size: 13px; font-weight: 700; color: var(--c-teal-700); }
.counter .val { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.counter .val small { font-size: 13px; margin-left: 2px; }
.counter.cash .val { color: #c56a00; }
.counter .sub { font-size: 11px; color: #567; }
.ranks { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-top: 6px; }
.rank { background: rgba(255, 255, 255, .85); border-radius: 10px; padding: 3px 8px; display: flex; align-items: center; justify-content: space-between; }
.rank .lbl { font-size: 13px; font-weight: 700; color: var(--c-teal-700); }
.rank .r { font-size: 24px; font-weight: 900; color: var(--c-hover-exec); }
.rank .n { font-size: 12px; color: #567; }
.stars { color: #E8A800; font-size: 20px; letter-spacing: -2px; }
.staffline { margin-top: 6px; background: rgba(255, 255, 255, .85); border-radius: 10px; padding: 4px 10px; font-size: 13px; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.staffline b { color: var(--c-teal-700); }
.staffline .warn { color: var(--c-warn); font-weight: 700; }
.minigraph { margin-top: 6px; background: rgba(255, 255, 255, .85); border-radius: 10px; height: 104px; }
.actions { position: absolute; left: 780px; top: 520px; width: 492px; }
.actiongrid { display: grid; grid-template-columns: repeat(3, 153px); gap: 6px 10px; justify-content: center; }
.actbtn { width: 153px; height: 41px; padding: 0; border: 0; background: transparent; cursor: pointer; position: relative; }
.actbtn img { width: 153px; height: 41px; display: block; }
.actbtn:hover img { filter: brightness(1.06) drop-shadow(0 0 3px var(--c-hover-exec)); }
.actbtn[disabled] { cursor: default; }
.actbtn[disabled] img { filter: grayscale(1); opacity: .45; }
.nextrow { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; padding: 0 6px; }
.nextbtn { width: 230px; height: 46px; border-radius: 999px; border: 3px solid #fff; background: linear-gradient(#FF9F40, #F07800); color: #fff; font-size: 22px; font-weight: 900; cursor: pointer; box-shadow: 0 4px 0 #A04F00; }
.nextbtn:hover { filter: brightness(1.08); }
.nextbtn[disabled] { opacity: .45; cursor: default; }
.autoquiz { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; color: var(--c-teal-800); cursor: pointer; }
.autoquiz input { width: 20px; height: 20px; }

/* animation view */
.anim { position: absolute; inset: 0; overflow: hidden; background: url("/assets/CompMng.AnimationHostControl/ImgBgTile.png") 0 0 / 14px 14px repeat; }
.anim.solid { background: #84D1C9; }
.anim .layer { position: absolute; inset: 0; }
.anim .layer img { width: 100%; height: 100%; object-fit: fill; display: block; }
.anim .fx { position: absolute; inset: -20%; width: 140%; height: 140%; object-fit: contain; }
.anim .star { filter: drop-shadow(0 0 6px rgba(255, 255, 0, .5)); }
@keyframes zoomAnim { from { transform: scale(1); } to { transform: scale(1.03); } }
@keyframes shakeAnim { from { transform: translateX(var(--from)); } to { transform: translateX(var(--to)); } }
@keyframes glowAnim { from { opacity: var(--o1); } to { opacity: var(--o2); } }
@media (prefers-reduced-motion: reduce) { .anim * { animation: none !important; } }

/* quiz card */
.quiz { display: flex; width: 1000px; height: 440px; background: #fff; border-radius: 16px; overflow: hidden; box-shadow: 0 8px 24px rgba(40, 120, 110, .25); }
.quiz .side { position: static; width: 190px; background: linear-gradient(#E8F9F6, #D4F0EA); display: flex; flex-direction: column; align-items: center; padding-top: 30px; gap: 14px; }
.quiz .q { width: 110px; height: 110px; border-radius: 50%; background: linear-gradient(#5ECFC4, #3AB8AA); color: #fff; font-size: 54px; font-weight: 900; display: flex; align-items: center; justify-content: center; }
.quiz .pick { font-size: 30px; font-weight: 700; color: #1A4E48; }
.quiz .mainq { flex: 1; padding: 26px 30px; display: flex; flex-direction: column; }
.quiz .badge { align-self: flex-start; padding: 2px 14px; border-radius: 999px; background: var(--c-accent); color: #fff; font-weight: 700; }
.quiz .question { font-size: 20px; font-weight: 500; line-height: 1.6; margin: 14px 0; flex: 1; overflow: auto; white-space: pre-line; }
.quiz .ox { display: flex; gap: 30px; justify-content: center; }
.quiz .ox button { width: 108px; height: 108px; border-radius: 16px; font-size: 58px; font-weight: 300; cursor: pointer; }
.quiz .ox .o { background: #F5FFFE; border: 2.5px solid #D0EDE9; color: #E8524A; }
.quiz .ox .x { background: #FDF8F8; border: 2.5px solid #E8D8D8; color: #2A3FA0; }
.quiz .ox button:hover { background: #FFFBF0; border-color: #F5A623; }
.quiz .ox button.sel { background: #FFF3D6; border-color: #E88F00; }
.quiz .result { font-size: 26px; font-weight: 900; padding: 8px 20px; border-radius: 12px; align-self: flex-start; animation: pop .4s cubic-bezier(.34, 1.56, .64, 1); }
.quiz .result.ok { background: #FFF0EF; border: 2px solid #F0857C; color: #E8524A; }
.quiz .result.ng { background: #EEF0FB; border: 2px solid #5272E0; color: #2A3FA0; }
.quiz .explain { font-size: 18px; line-height: 1.7; margin-top: 14px; animation: rise .38s .28s both cubic-bezier(.25, 1, .5, 1); white-space: pre-line; }
@keyframes pop { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes rise { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }

/* candidates / cards */
.cards { display: flex; gap: 16px; }
.card { flex: 1; background: #fff; border: 3px solid var(--c-band); border-radius: 12px; padding: 12px 14px; cursor: pointer; }
.card.sel { border-color: #E88F00; background: #FFF3D6; }
.card h3 { margin: 0 0 4px; color: var(--c-teal-700); font-size: 20px; }
.card .appeal { font-size: 14px; color: #456; min-height: 3em; margin: 6px 0; }
.skill { display: grid; grid-template-columns: 140px 1fr 34px; align-items: center; gap: 6px; font-size: 13px; margin: 2px 0; }
.skill .bar { height: 10px; border-radius: 5px; background: #E0F5F2; overflow: hidden; }
.skill .bar i { display: block; height: 100%; background: linear-gradient(90deg, #5ECFC4, #3AB8AA); }
.skill .n { text-align: right; font-variant-numeric: tabular-nums; }
.tabs2 { display: flex; gap: 6px; margin-bottom: 10px; }
.tabs2 button { padding: 4px 16px; border-radius: 999px; border: 2px solid #A8DDD7; background: #E8F5F3; color: #3A9E93; font-weight: 700; cursor: pointer; }
.tabs2 button.on { background: #3A9E93; color: #fff; }
.progress { height: 26px; background: #fff; border-radius: 13px; overflow: hidden; border: 2px solid var(--c-band); }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, #FFE84D, #F5C000); }
.genres { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.travel-opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.travel-opts .opt { background: #fff; border: 3px solid var(--c-band); border-radius: 10px; overflow: hidden; cursor: pointer; text-align: center; font-weight: 700; padding-bottom: 6px; }
.travel-opts .opt.sel { border-color: #E88F00; background: #FFF3D6; }
.travel-opts .opt img { width: 100%; height: 110px; object-fit: cover; display: block; }

/* report / game over */
.report-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 10px 0; }
.report-grid .counter .val { font-size: 26px; }
.gameover { position: absolute; inset: 0; }
.gameover .left { position: absolute; left: 40px; top: 109px; width: 440px; height: 483px; }
.gameover .right { position: absolute; left: 500px; top: 40px; width: 740px; height: 640px; padding: 20px 30px; overflow: auto; }
.gameover.clear .right { background: var(--c-gameclear); }
.gameover.bad .right { background: var(--c-gameover); }
.gameover h1 { margin: 0 0 10px; font-size: 36px; font-weight: 900; color: var(--c-teal-700); }
.bigscore { font-size: 54px; font-weight: 900; color: var(--c-hover-exec); }
