:root {
  color-scheme: light;
  --bg: #c7ecff;
  --text: #08304b;
  --muted: #477b9b;
  --panel: rgba(255, 255, 255, 0.7);
  --panel-border: rgba(255, 255, 255, 0.85);
  --card: #e7f6ff;
  --card-border: #9cd9ff;
  --ring: #4ab9ff;
  --chip-bg: rgba(255, 255, 255, 0.85);
  --chip-border: #6fbfff;
  --chip-active: linear-gradient(90deg, rgba(25, 211, 255, 0.6), rgba(255, 88, 203, 0.6));
}

body {
  font-family: "Noto Sans JP", "M PLUS 1p", system-ui, sans-serif;
  margin: 0;
  padding: 0;
  color: var(--text);
  background:
    radial-gradient(600px 420px at 20% 20%, rgba(100, 200, 255, 0.55), transparent 60%),
    radial-gradient(580px 430px at 80% 10%, rgba(160, 235, 255, 0.45), transparent 65%),
    radial-gradient(560px 520px at 25% 90%, rgba(190, 250, 255, 0.4), transparent 80%),
    radial-gradient(420px 480px at 80% 70%, rgba(220, 255, 255, 0.4), transparent 80%),
    var(--bg);
  background-attachment: fixed;
  overscroll-behavior: contain;
}

body.menu-open {
  overflow: hidden;
}

.hidden {
  display: none !important;
}

.app-shell {
  max-width: 1200px;
  margin: 0 auto 12px;
  padding: 0 8px 8px;
  background: transparent;
  border: none;
  border-radius: 0;
  backdrop-filter: none;
  box-sizing: border-box;
}

.page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
  background: transparent;
  border: none;
  padding: 0 0 4px;
  border-radius: 0;
  position: relative;
}

.header-left {
  display: grid;
  gap: 4px;
  padding-right: 44px;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-header h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 900;
  background: linear-gradient(90deg, #19d3ff, #ff58cb);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lunch-updated {
  font-size: 11px;
  color: var(--muted);
}

.help-btn {
  border: 1px solid var(--ring);
  background: rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  width: 30px;
  height: 30px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.menu-btn {
  border: 1px solid var(--ring);
  background: rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 18px;
  position: absolute;
  top: 4px;
  right: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.menu-btn.open {
  transform: rotate(90deg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

.menu-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 20;
}

.menu {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 200px;
  height: 100svh;
  max-height: 100dvh;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: -8px 0 20px rgba(0, 0, 0, 0.18);
  padding: calc(12px + env(safe-area-inset-top)) 10px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transform: translateX(100%);
  transition: transform 0.5s ease, opacity 0.5s ease;
  opacity: 0;
  z-index: 30;
  overflow: hidden;
}

.menu.hidden {
  display: flex !important;
  pointer-events: none;
}

.menu.open {
  transform: translateX(0%);
  opacity: 1;
  pointer-events: auto;
}

.menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 6px 0;
}

.menu-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.menu-close {
  border: 1px solid var(--chip-border);
  background: var(--chip-bg);
  border-radius: 999px;
  width: 28px;
  height: 28px;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.menu-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding-bottom: 8px;
}

.menu-item {
  border: 1px solid var(--chip-border);
  background: var(--chip-bg);
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 14px;
  text-align: left;
}

.menu-item.active {
  border-color: var(--ring);
  background: var(--chip-active);
  color: #fff;
}

.login-title {
  text-align: center;
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  width: 100%;
}

.login-title-main {
  font-size: 40px;
  font-weight: 900;
  background: linear-gradient(90deg, #19d3ff, #ff58cb);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.login-title-sub {
  font-size: 25px;
  color: var(--muted);
}

.login-title-ver {
  font-size: 13px;
  color: var(--muted);
}

.settings {
  display: grid;
  gap: 8px;
  margin: 10px auto 12px;
  max-width: 360px;
  width: 100%;
  justify-items: center;
  box-sizing: border-box;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 16px 12px;
  backdrop-filter: blur(8px) saturate(150%);
}

#login-btn {
  border: 1px solid var(--ring);
  background: linear-gradient(90deg, #19d3ff, #ff58cb);
  color: #fff;
  border-radius: 14px;
  padding: 8px 10px;
  font-size: 13px;
  width: 120px;
  box-sizing: border-box;
}

.settings label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  width: 100%;
  justify-items: center;
}

.settings input {
  border: 2px solid var(--ring);
  background: #fff;
  border-radius: 14px;
  padding: 8px 10px;
  font-size: 13px;
  width: 120px;
  box-sizing: border-box;
  margin: 0 auto;
}

.status {
  min-height: 0;
  height: 0;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 0;
  overflow: hidden;
}

.status.error {
  color: #d95555;
}

.lunch-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin: 6px 0 10px;
}

.lunch-tab {
  border: 1px solid var(--chip-border);
  background: #fff;
  color: var(--text);
  border-radius: 0;
  padding: 10px 14px;
  font-size: 16px;
  cursor: pointer;
  width: 100%;
  text-align: center;
  line-height: 1.4;
}

.lunch-tab > * {
  pointer-events: none;
}

.lunch-tab:first-child {
  border-radius: 12px 0 0 12px;
}

.lunch-tab:last-child {
  border-radius: 0 12px 12px 0;
}

.lunch-tab.active {
  background: linear-gradient(90deg, #19d3ff, #ff58cb);
  color: #ffffff;
  border-color: var(--ring);
}

.lunch-tab-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 2px;
}

.lunch-tab-line {
  font-size: 12px;
}

.lunch-tab-note {
  font-size: 10px;
}

.lunch-view {
  display: grid;
  gap: 12px;
}

.supplies-slide-wrap {
  display: flex;
  justify-content: center;
  margin: 8px 0 6px;
}

.supplies-slide-wrap img {
  max-width: 100%;
  width: min(100%, 680px);
  height: auto;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.lunch-summary {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.lunch-section {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.lunch-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.lunch-section-title {
  font-weight: 600;
  font-size: 14px;
}

.lunch-section-count {
  font-size: 12px;
  color: var(--muted);
}

.lunch-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.lunch-header {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
  white-space: nowrap;
  overflow: hidden;
}

.lunch-card {
  border: 1px solid var(--card-border);
  border-radius: 16px;
  background: var(--card);
  padding: 8px 10px;
  display: grid;
  gap: 0;
  font-size: 10px;
  position: relative;
  overflow: hidden;
}

.lunch-name {
  font-weight: 600;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lunch-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.lunch-pill {
  border: 1px solid var(--chip-border);
  border-radius: 999px;
  padding: 2px 6px;
  font-size: 7px;
  background: var(--chip-bg);
}

.lunch-done {
  background: rgba(0, 0, 0, 0.1);
  color: rgba(8, 48, 75, 0.55);
}

.lunch-done::after {
  content: "\63d0 \4f9b \6e08";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 25px;
  font-weight: 700;
  color: rgba(6, 35, 55, 0.35);
  pointer-events: none;
}

.lunch-tsuu {
  background: rgba(255, 88, 203, 0.2);
  border-color: rgb(255, 118, 212);
}

.lunch-note {
  border-color: #ff6b6b;
  color: #d45555;
}

.lunch-note.allergy {
  background: rgba(255, 98, 98, 0.916);
  color: #ffffff;
}

.list {
  display: grid;
  gap: 12px;
}

.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  touch-action: pan-y;
}

.card-body {
  padding: 14px;
  position: relative;
  z-index: 2;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
}

.card-updated {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.card-link {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  color: #0a64c0;
  word-break: break-all;
}

.card-amazon {
  margin-top: 6px;
  font-size: 13px;
  color: #3a3f4b;
}

.card-swipe {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: #fff;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.card-swipe-left {
  left: 0;
  background: #8b8f99;
}

.card-swipe-right {
  right: 0;
  background: #2b6fd6;
}

.card.dragging-left .card-swipe-left,
.card.dragging-right .card-swipe-right {
  opacity: 1;
}

.menu-logout {
  margin-top: auto;
  border-color: #d95555;
  color: #d95555;
  background: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  margin-bottom: calc(25px + env(safe-area-inset-bottom));
}

.help-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 40;
}

.help-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 24px;
  box-sizing: border-box;
}

.help-modal img {
  max-width: min(95vw, 900px);
  max-height: 85vh;
  width: auto;
  height: auto;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

@media (max-height: 700px) {
  .menu {
    padding: calc(8px + env(safe-area-inset-top)) 8px 0;
    gap: 6px;
  }

  .menu-item {
    padding: 8px 10px;
    font-size: 12px;
  }

  .menu-logout {
    margin-bottom: calc(8px + env(safe-area-inset-bottom));
  }
}
