* { box-sizing: border-box; }
    html, body {
      margin: 0;
      width: 100%;
      height: 100%;
      overflow: hidden;
      background: #0f1117;
      font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      color: #eef2ff;
    }
    #game {
      position: fixed;
      inset: 0;
      width: 100vw;
      height: 100vh;
    }
    #mainHud {
      position: fixed;
      top: 16px;
      left: 50%;
      transform: translateX(-50%);
      width: min(760px, calc(100vw - 32px));
      padding: 12px 16px;
      border-radius: 18px;
      background: rgba(9, 12, 20, 0.76);
      border: 1px solid rgba(255,255,255,0.16);
      box-shadow: 0 16px 48px rgba(0,0,0,0.34);
      backdrop-filter: blur(12px);
      pointer-events: none;
      z-index: 4;
    }
    #mainHudTop {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 14px;
      margin-bottom: 8px;
    }
    #mainTask {
      font-size: 18px;
      font-weight: 900;
      color: #fff;
      line-height: 1.25;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    #mainMeta {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      justify-content: flex-end;
      color: #dbeafe;
      font-size: 12px;
      white-space: nowrap;
    }
    .mainPill {
      padding: 4px 9px;
      border-radius: 999px;
      background: rgba(255,255,255,0.10);
      border: 1px solid rgba(255,255,255,0.12);
    }
    #mainHudBottom {
      display: grid;
      grid-template-columns: 1fr auto auto;
      align-items: center;
      gap: 12px;
    }
    #mainProgressOuter {
      height: 10px;
      border-radius: 999px;
      background: rgba(255,255,255,0.11);
      overflow: hidden;
    }
    #mainProgressInner {
      width: 100%;
      height: 100%;
      border-radius: 999px;
      background: linear-gradient(90deg, #67e8a5, #22c55e);
      transition: width 0.2s ease;
    }
    #mainVitals {
      display: flex;
      gap: 8px;
      color: #fff;
      font-size: 13px;
      font-weight: 800;
    }
    #mainDanger {
      min-width: 90px;
      text-align: center;
      padding: 5px 10px;
      border-radius: 999px;
      background: rgba(34,197,94,0.16);
      border: 1px solid rgba(167,243,208,0.35);
      color: #a7f3d0;
      font-size: 12px;
      font-weight: 900;
    }
    #debugHint {
      position: fixed;
      left: 16px;
      bottom: 16px;
      padding: 7px 10px;
      border-radius: 999px;
      background: rgba(13, 17, 27, 0.62);
      border: 1px solid rgba(255,255,255,0.10);
      color: #9ca3af;
      font-size: 11px;
      pointer-events: none;
      z-index: 3;
    }
    body.debug-on #debugHint {
      color: #bfdbfe;
      border-color: rgba(125,178,255,0.30);
    }
    #hud {
      position: fixed;
      top: 92px;
      left: 16px;
      width: 330px;
      padding: 14px 16px;
      border-radius: 16px;
      background: rgba(13, 17, 27, 0.82);
      border: 1px solid rgba(255,255,255,0.14);
      box-shadow: 0 16px 48px rgba(0,0,0,0.35);
      backdrop-filter: blur(10px);
      pointer-events: none;
      display: none;
      z-index: 8;
    }
    body.debug-on #hud { display: block; }
    #hud h1 {
      margin: 0 0 8px;
      font-size: 18px;
      letter-spacing: 0.04em;
    }
    #dayProgressOuter {
      margin-top: 8px;
      height: 8px;
      border-radius: 999px;
      background: rgba(255,255,255,0.10);
      overflow: hidden;
    }
    #dayProgressInner {
      width: 0%;
      height: 100%;
      border-radius: 999px;
      background: linear-gradient(90deg, #67e8a5, #7db2ff);
      transition: width 0.2s ease;
    }
    .row {
      display: flex;
      justify-content: space-between;
      gap: 16px;
      font-size: 13px;
      color: #aab3c5;
      line-height: 1.65;
    }
    .row strong { color: #fff; }
    #notice {
      position: fixed;
      top: 16px;
      right: 16px;
      max-width: 420px;
      padding: 14px 16px;
      border-radius: 16px;
      background: rgba(13, 17, 27, 0.82);
      border: 1px solid rgba(255,255,255,0.14);
      box-shadow: 0 16px 48px rgba(0,0,0,0.35);
      backdrop-filter: blur(10px);
      font-size: 13px;
      line-height: 1.65;
      color: #cbd5e1;
      pointer-events: none;
    }
    #notice b { color: #fff; }
    #mobAlert {
      position: fixed;
      left: 50%;
      top: 96px;
      transform: translateX(-50%);
      min-width: min(520px, calc(100vw - 32px));
      padding: 12px 18px;
      border-radius: 999px;
      background: rgba(128, 28, 28, 0.84);
      border: 1px solid rgba(255,180,180,0.32);
      color: #fff3f3;
      box-shadow: 0 14px 46px rgba(0,0,0,0.35);
      backdrop-filter: blur(10px);
      font-size: 14px;
      font-weight: 800;
      text-align: center;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.18s ease;
      z-index: 6;
    }
    #mobAlert.show { opacity: 1; }
    #taskToast {
      position: fixed;
      left: 50%;
      bottom: 74px;
      transform: translateX(-50%);
      min-width: min(560px, calc(100vw - 32px));
      padding: 12px 18px;
      border-radius: 18px;
      background: rgba(13, 17, 27, 0.84);
      border: 1px solid rgba(255,255,255,0.16);
      color: #eef2ff;
      box-shadow: 0 14px 46px rgba(0,0,0,0.35);
      backdrop-filter: blur(10px);
      font-size: 14px;
      font-weight: 700;
      text-align: center;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.18s ease;
      z-index: 6;
    }
    #taskToast.show { opacity: 1; }
    #controls {
      position: fixed;
      left: 50%;
      bottom: 18px;
      transform: translateX(-50%);
      padding: 10px 18px;
      border-radius: 999px;
      background: rgba(13, 17, 27, 0.78);
      border: 1px solid rgba(255,255,255,0.14);
      box-shadow: 0 12px 40px rgba(0,0,0,0.35);
      backdrop-filter: blur(10px);
      font-size: 13px;
      color: #cbd5e1;
      white-space: nowrap;
      pointer-events: none;
    }
    #overlay {
      position: fixed;
      inset: 0;
      display: grid;
      place-items: center;
      background: rgba(3, 6, 12, 0.62);
      backdrop-filter: blur(4px);
      z-index: 10;
    }
    #overlay.hidden { display: none; }
    .card {
      width: min(600px, calc(100vw - 32px));
      padding: 28px;
      border-radius: 24px;
      background: rgba(17, 22, 34, 0.95);
      border: 1px solid rgba(255,255,255,0.16);
      box-shadow: 0 30px 90px rgba(0,0,0,0.55);
      text-align: center;
    }
    .card h2 { margin: 0 0 10px; font-size: 30px; }
    .card p { margin: 8px 0; color: #aab3c5; line-height: 1.7; font-size: 14px; }
    #resultBox {
      margin-top: 14px;
      padding: 12px 14px;
      border-radius: 14px;
      background: rgba(255,255,255,0.06);
      border: 1px solid rgba(255,255,255,0.12);
      text-align: left;
      color: #cbd5e1;
      font-size: 13px;
      line-height: 1.65;
      display: none;
    }
    #resultBox.show { display: block; }
    .compactResult {
      margin-top: 12px;
      padding: 13px 15px;
      border-radius: 14px;
      background: rgba(255,255,255,0.07);
      border: 1px solid rgba(255,255,255,0.13);
      color: #e5e7eb;
      font-size: 14px;
      line-height: 1.7;
    }
    .compactResult b { color: #fff; }
    .compactResult__title {
      font-size: 16px;
      font-weight: 900;
      margin-bottom: 6px;
    }
    .compactResult__grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 4px 14px;
    }
    .compactResult__hint {
      margin-top: 8px;
      color: #9ca3af;
      font-size: 12px;
    }

    .newspaper {
      margin-top: 14px;
      padding: 18px 18px 16px;
      border-radius: 10px;
      background: #f3ead7;
      color: #111827;
      border: 1px solid rgba(54, 43, 28, 0.30);
      box-shadow: inset 0 0 0 1px rgba(255,255,255,0.45), 0 10px 28px rgba(0,0,0,0.22);
      font-family: Georgia, "Times New Roman", "Yu Mincho", "Hiragino Mincho ProN", serif;
      line-height: 1.62;
    }
    .newspaper__masthead {
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      gap: 12px;
      border-bottom: 3px double rgba(17,24,39,0.75);
      padding-bottom: 8px;
      margin-bottom: 10px;
      color: #111827;
    }
    .newspaper__name {
      font-size: 24px;
      font-weight: 900;
      letter-spacing: 0.08em;
    }
    .newspaper__date {
      font-size: 12px;
      white-space: nowrap;
      color: #1f2937;
      font-weight: 700;
    }
    .newspaper__headline {
      font-size: 22px;
      font-weight: 900;
      line-height: 1.25;
      margin: 10px 0 8px;
      color: #0f172a;
    }
    .newspaper__subhead {
      font-size: 13px;
      font-weight: 800;
      color: #1f2937;
      border-top: 1px solid rgba(17,24,39,0.35);
      border-bottom: 1px solid rgba(17,24,39,0.35);
      padding: 6px 0;
      margin-bottom: 10px;
    }
    .newspaper__body {
      columns: 2;
      column-gap: 20px;
      font-size: 14px;
      color: #1f2937;
      font-weight: 600;
    }
    .newspaper__body p {
      margin: 0 0 9px;
      text-align: justify;
      color: #1f2937;
    }
    .newspaper__facts {
      display: none;
    }
    .newspaper__tag {
      display: inline-block;
      padding: 2px 7px;
      border: 1px solid rgba(17,24,39,0.55);
      border-radius: 999px;
      font-size: 11px;
      font-weight: 800;
      margin-right: 4px;
      color: #111827;
    }
    .newspaper__note {
      margin-top: 10px;
      padding-top: 8px;
      border-top: 1px solid rgba(17,24,39,0.28);
      font-size: 12px;
      color: #374151;
      font-style: italic;
      font-weight: 700;
    }
    #nextDayBtn {
      margin-top: 12px;
      margin-left: 8px;
      padding: 12px 24px;
      border: 0;
      border-radius: 999px;
      background: #67e8a5;
      color: #062014;
      font-size: 15px;
      font-weight: 800;
      cursor: pointer;
      display: none;
    }
    #nextDayBtn.show { display: inline-block; }
    .card button {
      margin-top: 18px;
      padding: 12px 24px;
      border: 0;
      border-radius: 999px;
      background: #7db2ff;
      color: #08111f;
      font-size: 15px;
      font-weight: 800;
      cursor: pointer;
    }
    .card button:hover { filter: brightness(1.08); }

/* v0.25.5: InputManagerスマホUI調整版 */
#mobileHint {
  position: fixed;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  width: min(520px, calc(100vw - 24px));
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(13,17,27,0.84);
  border: 1px solid rgba(255,255,255,0.14);
  color: #e5e7eb;
  font-size: 12px;
  line-height: 1.55;
  text-align: center;
  z-index: 8;
  display: none;
  pointer-events: none;
}
#touchControls {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 7;
  display: none;
}
#virtualStick {
  position: absolute;
  left: max(18px, env(safe-area-inset-left));
  bottom: max(24px, env(safe-area-inset-bottom));
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: rgba(15,23,42,0.52);
  border: 1px solid rgba(255,255,255,0.18);
  box-shadow: 0 10px 32px rgba(0,0,0,0.30);
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
#stickKnob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: rgba(125,178,255,0.82);
  border: 1px solid rgba(255,255,255,0.38);
  box-shadow: 0 0 18px rgba(125,178,255,0.50);
}
#touchButtons {
  position: absolute;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(22px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(2, 76px);
  grid-auto-rows: 58px;
  gap: 10px;
  pointer-events: auto;
}
.touchBtn {
  border: 1px solid rgba(255,255,255,0.20);
  border-radius: 16px;
  background: rgba(13,17,27,0.72);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 10px 28px rgba(0,0,0,0.30);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.touchBtn:active,
.touchBtn.active {
  background: rgba(103,232,165,0.86);
  color: #062014;
}
body.pc-device #mobileHint,
body.pc-device #touchControls {
  display: none !important;
}
body.mobile-device #touchControls {
  display: block;
}
body.mobile-device.mobile-portrait #mobileHint {
  display: block;
  animation: mobileHintAutoHide 4.8s ease forwards;
}
body.mobile-device.mobile-landscape #mobileHint {
  display: none;
}
@keyframes mobileHintAutoHide {
  0% { opacity: 0; transform: translateX(-50%) translateY(8px); }
  10% { opacity: 1; transform: translateX(-50%) translateY(0); }
  72% { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(10px); visibility: hidden; }
}
body.mobile-device #controls {
  display: none;
}

@media (max-width: 820px) {
  #virtualStick {
    width: 116px;
    height: 116px;
    left: max(14px, env(safe-area-inset-left));
    bottom: max(18px, env(safe-area-inset-bottom));
  }
  #stickKnob {
    width: 52px;
    height: 52px;
  }
  #touchButtons {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(18px, env(safe-area-inset-bottom));
    grid-template-columns: repeat(2, 70px);
    grid-auto-rows: 54px;
    gap: 8px;
  }
  .touchBtn {
    font-size: 12px;
    border-radius: 14px;
  }
  body.mobile-device.mobile-portrait #touchControls {
    opacity: 0.95;
  }
}

/* v0.25.5: スマホ縦画面の操作位置・横画面HUD幅を調整 */
body.mobile-device.mobile-portrait #virtualStick {
  left: max(44px, calc(env(safe-area-inset-left) + 34px));
  bottom: max(88px, calc(env(safe-area-inset-bottom) + 78px));
}
body.mobile-device.mobile-portrait #touchButtons {
  bottom: max(28px, env(safe-area-inset-bottom));
}
body.mobile-device.mobile-landscape #mainHud {
  width: clamp(280px, 34vw, 420px);
  padding: 6px 8px;
  border-radius: 14px;
}
body.mobile-device.mobile-landscape #mainHudTop {
  gap: 6px;
  margin-bottom: 5px;
}
body.mobile-device.mobile-landscape #mainTask {
  font-size: 12px;
}
body.mobile-device.mobile-landscape #mainMeta {
  font-size: 9px;
  gap: 4px;
}
body.mobile-device.mobile-landscape #mainProfile,
body.mobile-device.mobile-landscape #mainProgressText {
  display: none;
}
body.mobile-device.mobile-landscape #mainHudBottom {
  grid-template-columns: 1fr auto;
  gap: 6px;
}
body.mobile-device.mobile-landscape #mainProgressOuter {
  height: 7px;
}
body.mobile-device.mobile-landscape #mainVitals {
  font-size: 11px;
}
body.mobile-device.mobile-landscape #mainDanger {
  display: none;
}

/* v0.25.4 Mobile result scroll + simplified mobile information */
#overlay {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
}
#overlay .card {
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

body.mobile-device #overlay {
  display: block;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: max(12px, env(safe-area-inset-top)) 12px calc(170px + env(safe-area-inset-bottom));
  touch-action: pan-y;
}
body.mobile-device #overlay.hidden {
  display: none !important;
}
body.mobile-device #overlay .card {
  width: min(560px, calc(100vw - 24px));
  max-height: none;
  overflow: visible;
  margin: 0 auto 18px;
  padding: 22px 18px;
}
body.mobile-device #resultBox {
  font-size: 12px;
  line-height: 1.55;
}
body.mobile-device .newspaper {
  padding: 14px 13px;
  margin-top: 10px;
}
body.mobile-device .newspaper__body {
  columns: 1;
  font-size: 12px;
  line-height: 1.55;
}
body.mobile-device .newspaper__headline {
  font-size: 17px;
}
body.mobile-device .newspaper__masthead {
  gap: 8px;
}
body.mobile-device .newspaper__name {
  font-size: 18px;
}
body.mobile-device .compactResult__grid {
  grid-template-columns: 1fr;
}

/* スマホでは画面を広く使うため、説明パネルと速報ログを非表示にする */
body.mobile-device #notice,
body.mobile-device #newsFeed,
body.mobile-device #dangerCompass,
body.mobile-device #debugHint {
  display: none !important;
}
body.mobile-device #mainHud {
  top: max(8px, env(safe-area-inset-top));
  width: calc(100vw - 16px);
  padding: 8px 10px;
}
body.mobile-device #mainTask {
  font-size: 14px;
}
body.mobile-device #mainMeta {
  font-size: 10px;
  gap: 5px;
}
body.mobile-device .mainPill {
  padding: 3px 6px;
}
body.mobile-device #mainHudBottom {
  grid-template-columns: 1fr auto;
  gap: 8px;
}
body.mobile-device #mainDanger {
  min-width: 62px;
  padding: 4px 7px;
  font-size: 11px;
}
body.mobile-device #taskToast {
  bottom: calc(150px + env(safe-area-inset-bottom));
  width: calc(100vw - 24px);
  min-width: 0;
  font-size: 12px;
  padding: 9px 12px;
}
body.mobile-device #mobAlert {
  top: calc(86px + env(safe-area-inset-top));
  min-width: 0;
  width: calc(100vw - 24px);
  font-size: 12px;
  padding: 9px 12px;
}


/* v0.25.5 final overrides: 横画面HUDを全幅ではなく約1/3へ */
body.mobile-device.mobile-landscape #mainHud {
  width: clamp(280px, 34vw, 420px) !important;
  padding: 6px 8px !important;
  border-radius: 14px;
}
body.mobile-device.mobile-landscape #mainProfile,
body.mobile-device.mobile-landscape #mainProgressText {
  display: none !important;
}
body.mobile-device.mobile-landscape #mainDanger {
  display: none !important;
}
