:root {
  color-scheme: light;
  --ink: #2d251e;
  --ink-2: #46392b;
  --muted: #685b4b;
  --bg: #faf4ea;
  --bg-card: #fffaf2;
  --bg-soft: #f7f0e6;
  --bg-tint: #f3e1c6;
  --line: #dfd0bb;
  --line-strong: #cab398;
  --accent: #bd8549;
  font-family: system-ui, "Microsoft YaHei", sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { min-width: 280px; margin: 0; background: #211b17; color: #fff6e3; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
:is(a, button, input):focus-visible { outline: 2px solid #da9d59; outline-offset: 4px; }
.menu-toolbar {
  position: absolute;
  z-index: 1;
  inset: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: max(20px,env(safe-area-inset-top)) clamp(16px,5vw,70px) 0;
  pointer-events: none;
}
.menu-exit, .user-badge { pointer-events: auto; }
.menu-exit { text-decoration: none; padding-block: 9px; font-size: .9rem; }
.menu-exit:hover { text-decoration: underline; }
.user-badge { display: flex; align-items: center; gap: 8px; padding: 4px 5px 4px 11px;
  border: 1px solid #fff3d743; border-radius: 7px; background: #201912e6; font-size: .78rem; }
.user-dot { flex: 0 0 6px; height: 6px; border-radius: 50%; background: #d8bb90; }
.user-badge #userName { max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-badge .btn { min-height: 32px; background: #fff2d419; color: #fff6e3; border-color: #fff2d440; }
.title-screen {
  position: relative;
  min-height: 100svh;
  display: grid;
  align-items: center;
  padding: 90px clamp(22px,8vw,150px) max(42px,env(safe-area-inset-bottom));
  background: linear-gradient(90deg,#18120ee8,#18120e68 47%,#18120e16 78%),
    url("../assets/images/office/main-menu.jpg") 58% center / cover no-repeat;
}
.title-content { width: min(100%, 370px); }
.title-heading { margin-block: 0 clamp(22px,5vh,54px); }
.title-heading p { margin: 0 0 12px; color: #e1b787; font-size: clamp(.8rem,1.6vw,1rem); letter-spacing: .19em; }
.title-heading h1 {
  margin: 0 0 12px;
  font: 700 clamp(3.1rem,8vw,6.4rem)/1.02 "Songti SC","Noto Serif CJK SC",SimSun,serif;
  letter-spacing: .04em;
  white-space: nowrap;
}
.title-heading > span { color: #e9d7bb; font-size: 1rem; letter-spacing: .26em; }
.title-actions { display: grid; gap: 8px; }
.title-action {
  width: 100%; min-height: 52px; padding: 12px 17px; border: 1px solid #ead7b048;
  background: #231b14c9; color: #fff6e3; text-align: left; border-radius: 6px;
  display: flex; align-items: center; justify-content: space-between; cursor: pointer;
  transition: background .18s, border-color .18s;
}
.title-action.primary { background: #f1d3a9; color: #2c2117; border-color: #f1d3a9; font-weight: 650; }
.title-action:hover:not(:disabled) { background-color: #49372a; border-color: #dfb882; }
.title-action.primary:hover:not(:disabled) { background: #ffe1b4; }
.title-save { margin-top: 18px; display: grid; gap: 4px; min-height: 41px; color: #e6ccaa; font-size: .8rem; line-height: 1.5; }
.title-save strong { color: #fff2dc; }
.game-region-mask { position: absolute; inset: 0; display: grid; place-items: center; padding: 18px; background: #201810a1; backdrop-filter: blur(6px); }
.game-region-message { background: var(--bg-card); color: var(--ink); border-radius: 10px; padding: 24px; max-width: 100%; }
.game-region-message h2 { margin: 0; font-size: 1.2rem; }
.game-region-message p { color: var(--muted); }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.btn, .btn-sm {
  display: inline-flex; align-items: center; justify-content: center; padding: 7px 12px; min-height: 40px;
  border: 1px solid var(--line-strong); border-radius: 6px; background: var(--bg-soft);
  color: var(--ink); text-decoration: none; font-size: .83rem; cursor: pointer;
}
.btn.primary { background: #e2b781; border-color: #bd8549; color: #2c2117; }
.btn:hover:not(:disabled), .btn-sm:hover:not(:disabled) { border-color: var(--accent); }
.modal-overlay { display: none; position: fixed; z-index: 10; inset: 0; background: #17100ac2; backdrop-filter: blur(5px); padding: 18px; align-items: center; justify-content: center; }
.modal-overlay.show { display: flex; }
.modal-box, .credits { color: var(--ink); background: var(--bg-card); border: 1px solid var(--line-strong); border-radius: 12px; padding: 24px; box-shadow: 0 24px 65px #0005; }
.modal-box { width: min(100%,440px); }
.modal-box.mode-box { width: min(100%,850px); }
.modal-box h3 { margin: 0; }
.modal-box input { width: 100%; padding: 10px; margin-bottom: 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--bg); color: var(--ink); }
.modal-box .tip { color: var(--muted); line-height: 1.6; font-size: .85rem; }
.saves-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap: 10px; }
.save-card { border: 1px solid var(--line); border-radius: 8px; }
.legacy-recovery { margin-top: 16px; font-size: .85rem; }
.credits { width: min(460px,calc(100% - 32px)); }
.credits::backdrop { background: #17100ac2; backdrop-filter: blur(5px); }
.credits header, .credits dl div, .credits-egg { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.credits h2 { font-size: 1.3rem; margin: 0; }
.credits dl { margin: 24px 0; }
.credits dd { margin: 0; font-weight: 650; }
.credits header button, .credits-egg { border: 1px solid var(--line-strong); border-radius: 6px; background: var(--bg-soft); color: var(--ink); cursor: pointer; }
.credits header button { width: 40px; height: 40px; font-size: 1.35rem; }
.credits-egg { width: 100%; min-height: 46px; text-align: left; padding: 9px 12px; }
.credits-egg:hover { background: var(--bg-tint); }
@media (max-width: 620px) {
  .menu-toolbar { flex-wrap: wrap; }
  .title-screen {
    align-items: end; padding-top: 115px; background-position: 66% center;
    background-image: linear-gradient(180deg,#19141054,#191410aa 38%,#191410f0 78%),url("../assets/images/office/main-menu.jpg");
  }
  .title-heading h1 { font-size: clamp(2.85rem,13vw,4.6rem); }
}
@media (prefers-reduced-motion: reduce) { .title-action { transition: none; } }
#modePicker .mode-option--free { text-decoration: none; }
#modePicker .mode-option {
  grid-template-rows: auto 1fr;
  gap: 0;
  padding: 0;
  overflow: hidden;
}
#modePicker .mode-cover {
  position: relative;
  display: block;
  aspect-ratio: 2.3;
  overflow: hidden;
  background: #4b5147;
}
#modePicker .mode-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 46%;
}
#modePicker .mode-cover small {
  position: absolute;
  bottom: 6px;
  left: 8px;
  padding: 2px 5px;
  border-radius: 3px;
  background: #18241eed;
  color: #fff9ed;
  font-size: 10px;
}
#modePicker .mode-copy { display: grid; gap: 3px; padding: 10px 14px; line-height: 1.4; }
#modePicker .mode-copy strong { color: #222d27; }
@media (max-width: 560px) {
  #modePicker .mode-option { grid-template-columns: minmax(95px, 35%) 1fr; grid-template-rows: auto; }
  #modePicker .mode-cover { min-height: 85px; aspect-ratio: auto; }
  #modePicker .mode-cover img { position: absolute; inset: 0; }
  #modePicker .mode-copy { align-content: center; }
}
