:root {
      --primary-color: #334155;
      --primary-dark: #0f172a;
      --cool-bg: #e5e7eb;
      --cool-card: #f8fafc;
      --cool-border: #cbd5e1;
      --cool-shadow: 0 24px 70px rgba(15, 23, 42, 0.16);
    }
    html, body {
      color-scheme: only light;
      background-color: #e5e7eb;
      forced-color-adjust: none;
      -webkit-print-color-adjust: exact;
      print-color-adjust: exact;
      -webkit-text-size-adjust: 100%;
    }
    html,
    .qr-page-body,
    .qr-page-body *:not(img),
    .qr-page-body *::before,
    .qr-page-body *::after {
      color-scheme: only light !important;
      forced-color-adjust: none !important;
    }
    body {
      background:
        radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.86) 0, rgba(255, 255, 255, 0.28) 20%, transparent 42%),
        linear-gradient(145deg, #eef2f7 0%, #d9e0e8 52%, #b7c0cc 100%);
      color: #0f172a;
      min-height: 100vh;
      min-height: 100svh;
      margin: 0;
      overflow-x: hidden;
      overflow-y: auto;
      overflow-anchor: none;
      scroll-padding-top: max(0.75rem, env(safe-area-inset-top));
      overscroll-behavior-y: none;
    }
    #qr-page-shell {
      width: 100%;
      min-height: 100vh;
      min-height: 100svh;
      background-color: #f8fafc !important;
      padding-top: max(0.5rem, env(safe-area-inset-top));
      padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
      overflow: visible;
    }
    .qr-topbar { padding-top: 0.5rem; }
    .hidden { display: none !important; }
    .btn-primary {
      background: linear-gradient(135deg, #475569, #0f172a) !important;
      color: white !important;
      box-shadow: 0 18px 34px rgba(15, 23, 42, .22) !important;
    }
    .warm-shell { background: #f8fafc; }
    .warm-card {
      background: #ffffff;
      border-color: rgba(203, 213, 225, 0.95);
      box-shadow: var(--cool-shadow);
    }
    .quiet-link {
      background: rgba(255,255,255,.82);
      color: #334155;
      border: 1px solid rgba(203,213,225,.95);
    }
    .quiet-link:hover { background: #f8fafc; color: #0f172a; }
    .quick-action {
      min-height: 68px;
      border-radius: 22px;
      border: 2px solid rgba(203, 213, 225, 0.95);
      background: rgba(248, 250, 252, 0.92);
      color: #334155;
      font-weight: 900;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
      transition: transform .12s ease, background .12s ease, border-color .12s ease;
    }
    .quick-action:active { transform: scale(0.97); }
    .quick-action:hover { background: #ffffff; border-color: #94a3b8; }
    .menu-day-card {
      border: 1px solid #d8dee8;
      border-radius: 18px;
      background: #ffffff;
      padding: 16px;
      box-shadow: 0 8px 20px rgba(15, 23, 42, .07);
    }
    .menu-pill {
      display: inline-flex;
      align-items: center;
      border-radius: 999px;
      padding: 4px 10px;
      background: #f8fafc;
      color: #334155;
      font-size: 12px;
      font-weight: 800;
      border: 1px solid #cbd5e1;
      margin: 2px;
    }
    .menu-origin-chip {
      display: inline-flex;
      align-items: stretch;
      overflow: hidden;
      border-radius: 14px;
      border: 1px solid #d8dee8;
      background: #ffffff;
      color: #334155;
      font-size: 12px;
      margin: 2px 0;
      box-shadow: 0 4px 10px rgba(15, 23, 42, .05);
    }
    .menu-origin-chip strong {
      display: inline-flex;
      align-items: center;
      padding: 5px 9px;
      background: #f1f5f9;
      color: #0f172a;
      font-weight: 900;
      border-right: 1px solid #d8dee8;
      white-space: nowrap;
    }
    .menu-origin-chip em {
      display: inline-flex;
      align-items: center;
      padding: 5px 9px;
      color: #475569;
      font-style: normal;
      font-weight: 700;
    }

    #qrcode-container {
      width: min(100%, 34rem);
      margin-inline: auto;
      background-color: #ffffff !important;
      color: #0f172a !important;
      isolation: isolate;
    }
    #qrcode {
      --qr-render-size: 280px;
      width: 100%;
      max-width: min(calc(100vw - 72px), 380px);
      aspect-ratio: 1 / 1;
      margin: 0 auto 1.5rem;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: clamp(12px, 2.6vw, 18px);
      overflow: hidden;
      box-sizing: border-box;
      background: #ffffff !important;
      color: #000000 !important;
      color-scheme: only light !important;
      forced-color-adjust: none !important;
      -webkit-print-color-adjust: exact;
      print-color-adjust: exact;
      filter: none !important;
      mix-blend-mode: normal !important;
      isolation: isolate;
    }
    #qrcode canvas,
    #qrcode img,
    #qrcode table {
      width: 100% !important;
      height: 100% !important;
      max-width: 100% !important;
      max-height: 100% !important;
      object-fit: contain;
      display: block;
      margin: 0 auto;
      image-rendering: pixelated;
      background: #ffffff !important;
      color: #000000 !important;
      color-scheme: only light !important;
      forced-color-adjust: none !important;
      filter: none !important;
      mix-blend-mode: normal !important;
    }
    #qrcode img[data-lunchcheck-qr-image="true"] {
      opacity: 1 !important;
      visibility: visible !important;
      image-rendering: pixelated;
    }
    #qrcode canvas,
    #qrcode img,
    #qrcode table,
    #qrcode table * {
      color-scheme: only light !important;
      forced-color-adjust: none !important;
      filter: none !important;
      mix-blend-mode: normal !important;
    }
    #qrcode > div {
      width: min(var(--qr-render-size), 100%);
      height: min(var(--qr-render-size), 100%);
      display: flex;
      align-items: center;
      justify-content: center;
    }
    @media (orientation: landscape) and (max-height: 560px) {
      header { padding-top: 1rem !important; padding-bottom: 1rem !important; }
      header .brand-plate-lg img { width: 4.75rem !important; height: 4.75rem !important; }
      header h1 { font-size: 2.4rem !important; }
      main { padding-top: 0.5rem !important; }
      #qrcode-container, #qr-form-container { padding: 1rem 1rem 1.2rem !important; }
      #qrcode { max-width: min(calc(100vw - 68px), 300px); margin-bottom: 1rem; }
      #qr-result-name { font-size: 1.9rem !important; margin-bottom: 0.35rem !important; }
      #qrcode-container p { margin-bottom: 0.85rem !important; font-size: 1rem !important; }
      #btn-reissue-qr { height: 3.4rem !important; }
      #btn-back-to-form { height: 3rem !important; margin-top: 0.6rem !important; }
    }



    html.menu-modal-open,
    body.menu-modal-open,
    html.install-guide-open,
    body.install-guide-open {
      overflow: hidden !important;
      overscroll-behavior: none !important;
      touch-action: none;
    }

    #menu-modal,
    #ios-install-modal {
      position: fixed !important;
      top: 0 !important;
      right: 0 !important;
      bottom: 0 !important;
      left: 0 !important;
      width: 100vw !important;
      min-width: 100vw !important;
      height: 100vh !important;
      min-height: 100dvh !important;
      max-height: none !important;
      box-sizing: border-box;
      overflow: hidden !important;
      overscroll-behavior: none;
      align-items: center !important;
      justify-content: center !important;
      padding-top: max(0.75rem, env(safe-area-inset-top));
      padding-right: max(0.75rem, env(safe-area-inset-right));
      padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
      padding-left: max(0.75rem, env(safe-area-inset-left));
      transform: none !important;
      contain: layout paint;
    }

    #menu-modal-panel,
    #ios-install-panel {
      width: min(100%, 42rem);
      max-height: calc(var(--modal-viewport-height, 100dvh) - max(1.5rem, env(safe-area-inset-top) + env(safe-area-inset-bottom)));
      min-height: 0;
      margin: 0 !important;
      transform: none !important;
      overscroll-behavior: contain;
      -webkit-overflow-scrolling: touch;
      box-sizing: border-box;
    }

    #menu-modal-panel {
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }

    #ios-install-panel {
      overflow-y: auto;
      touch-action: pan-y;
    }

    #menu-modal-header,
    #menu-modal-controls {
      flex: 0 0 auto;
    }

    #menu-list {
      flex: 1 1 auto;
      min-height: 0;
      max-height: none !important;
      overflow-y: auto;
      overscroll-behavior: contain;
      -webkit-overflow-scrolling: touch;
      touch-action: pan-y;
    }

    @media (max-width: 640px) {
      #menu-modal,
      #ios-install-modal {
        padding-top: max(0.55rem, env(safe-area-inset-top));
        padding-right: max(0.55rem, env(safe-area-inset-right));
        padding-bottom: max(0.55rem, env(safe-area-inset-bottom));
        padding-left: max(0.55rem, env(safe-area-inset-left));
        align-items: center !important;
      }

      #menu-modal-panel,
      #ios-install-panel {
        width: 100%;
        max-height: calc(var(--modal-viewport-height, 100dvh) - max(1.1rem, env(safe-area-inset-top) + env(safe-area-inset-bottom) + 0.6rem));
        border-width: 2px;
        border-radius: 1.35rem;
      }

      #ios-install-panel {
        padding: 1.05rem !important;
      }

      #menu-modal-header,
      #menu-modal-controls,
      #menu-list {
        padding: 1rem;
      }

      #menu-modal-header h3 { font-size: 1.25rem; }
      #menu-modal-header p { font-size: 0.76rem; }
      #menu-modal-controls { gap: 0.55rem; }
      #menu-modal-controls input,
      #menu-modal-controls button { min-height: 44px; }
    }

    @media (max-width: 640px) {
      #qr-page-shell {
        min-height: 100svh;
        padding-top: max(0.65rem, env(safe-area-inset-top));
        box-shadow: none;
      }
      .qr-topbar {
        flex: 0 0 auto;
        padding-top: 0;
      }
      #qr-page-header {
        flex: 0 0 auto;
        padding-top: 1.15rem !important;
        padding-bottom: 1.35rem !important;
      }
      #qr-page-main {
        flex: 0 0 auto;
        justify-content: flex-start !important;
        padding-top: 0.25rem;
      }
      #qr-form-container,
      #qrcode-container {
        scroll-margin-top: max(1rem, env(safe-area-inset-top));
      }
    }

    @media (max-width: 480px) {
      .input-label { font-size: 1.1rem; }
      .form-input { height: 64px; font-size: 1.05rem; }
      .btn { height: 72px; font-size: 1.15rem; }
      .quick-action { min-height: 58px; font-size: 0.92rem; border-radius: 18px; }
    }


.monthly-qr-notice {
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.96), rgba(241, 245, 249, 0.92));
  color: #334155;
  border-radius: 1.25rem;
  padding: 0.9rem 1rem;
  margin-top: 0.25rem;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}
.monthly-qr-notice strong {
  display: block;
  color: #0f172a;
  font-size: 0.95rem;
  font-weight: 900;
  margin-bottom: 0.25rem;
}
.monthly-qr-notice p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
  font-weight: 700;
}
#qrcode[data-lunchcheck-qr="true"] {
  background-color: #ffffff !important;
  color: #000000 !important;
  color-scheme: only light !important;
  forced-color-adjust: none !important;
  filter: none !important;
  mix-blend-mode: normal !important;
}
#qrcode[data-lunchcheck-qr="true"] canvas,
#qrcode[data-lunchcheck-qr="true"] img,
#qrcode[data-lunchcheck-qr="true"] table {
  background-color: #ffffff !important;
  color-scheme: only light !important;
  forced-color-adjust: none !important;
  filter: none !important;
  mix-blend-mode: normal !important;
}
@media (prefers-color-scheme: dark) {
  #qrcode, #qrcode * {
    color-scheme: only light !important;
    forced-color-adjust: none !important;
    filter: none !important;
    mix-blend-mode: normal !important;
  }
}

/* Some Android browsers force-dark translucent surfaces despite the page color scheme. */
body.qr-page-body {
  background-color: #e5e7eb !important;
  color: #0f172a !important;
}
.qr-page-body #qr-page-shell,
.qr-page-body .warm-shell {
  background-color: #f8fafc !important;
  color: #0f172a !important;
}
.qr-page-body .warm-card,
.qr-page-body #qrcode-container,
.qr-page-body #menu-modal-panel,
.qr-page-body #ios-install-panel {
  background-color: #ffffff !important;
  color: #0f172a !important;
}
.qr-page-body input,
.qr-page-body select,
.qr-page-body textarea {
  background-color: #f8fafc !important;
  color: #0f172a !important;
}
