/* --- CSS Reset & Variables --- */
:root {
  --brand-color: #9b72b0; /* ラベンダー */
  --accent-color: #d19bb6; /* 朝焼けピンク */
  --background-color: #faf9f6;
  --text-color: #4a4a4a;
  --card-bg-color: #ffffff;
  --footer-bg-color: #ffffff;
  --border-color: #e0e0e0;
  --primary-action: var(--brand-color);
  --safe-bottom: env(safe-area-inset-bottom, 20px);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
  font-family: "M PLUS Rounded 1c", "Helvetica Neue", Arial, sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  padding-bottom: calc(90px + var(--safe-bottom));
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

/* --- Header --- */
.app-header {
  background: linear-gradient(135deg, var(--brand-color), var(--accent-color));
  color: white;
  padding: 15px 20px;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.app-header h1 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 1px;
}

/* --- Menu Grid --- */
.menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  padding: 15px;
}

.menu-card {
  background: var(--card-bg-color);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
}

.menu-img-wrapper {
  width: 100%;
  padding-top: 100%; /* 1:1 Aspect Ratio */
  position: relative;
  background-color: #f5f5f5;
}

.menu-img-wrapper img {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  object-fit: cover;
}

.menu-info {
  padding: 12px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.menu-name { font-weight: bold; font-size: 0.95rem; margin-bottom: 5px; }
.menu-price { color: var(--brand-color); font-weight: bold; font-size: 1.1rem; margin-bottom: 8px; }
.menu-desc { font-size: 0.75rem; color: #777; line-height: 1.4; flex-grow: 1; margin-bottom: 10px; }

.add-button {
  background-color: var(--accent-color);
  color: white;
  border: none;
  border-radius: 20px;
  padding: 8px 0;
  font-weight: bold;
  width: 100%;
  cursor: pointer;
}

/* --- Footer Cart --- */
.cart-footer {
  position: fixed;
  bottom: 0; left: 0; width: 100%;
  background: var(--footer-bg-color);
  padding: 15px 20px calc(15px + var(--safe-bottom));
  box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
}

.total-price-display {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--text-color);
}

.total-price-display span {
  font-size: 1.4rem;
  color: var(--brand-color);
  margin-left: 5px;
}

.view-cart-button {
  background-color: var(--brand-color);
  color: white;
  border: none;
  border-radius: 25px;
  padding: 12px 24px;
  font-weight: bold;
  font-size: 1rem;
  position: relative;
}

.view-cart-button:disabled {
  background-color: #ccc;
}

.cart-badge {
  position: absolute;
  top: -5px; right: -5px;
  background-color: #ff4d4f;
  color: white;
  font-size: 0.75rem;
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex; justify-content: center; align-items: center;
}

/* --- Modals --- */
.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  display: none; justify-content: center; align-items: flex-end;
  z-index: 1000;
}

.modal-content {
  background: white;
  width: 100%;
  max-height: 90vh;
  border-radius: 20px 20px 0 0;
  display: flex; flex-direction: column;
}

.modal-header {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex; justify-content: space-between; align-items: center;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

/* --- Forms --- */
.form-group { margin-bottom: 15px; }
.form-group label { display: block; font-weight: bold; margin-bottom: 5px; font-size: 0.9rem; color: var(--brand-color); }
.form-group input, .form-group textarea {
  width: 100%; padding: 12px; border-radius: 8px; border: 1px solid #ccc;
  font-size: 1rem; background: #fafafa;
}
.badge { font-size: 0.7rem; padding: 2px 6px; border-radius: 4px; margin-left: 5px; }
.badge-req { background-color: #ff4d4f; color: white; }
.badge-opt { background-color: #ccc; color: white; }

.submit-button {
  background-color: var(--brand-color);
  color: white; border: none; border-radius: 25px;
  padding: 15px; font-size: 1.1rem; font-weight: bold; width: 100%;
  margin-top: 15px;
}

/* --- Cart Items --- */
.cart-item {
  display: flex; justify-content: space-between; align-items: center;
  padding-bottom: 15px; margin-bottom: 15px; border-bottom: 1px dashed #eee;
}
.cart-item-info h4 { margin-bottom: 5px; font-size: 1rem; }
.cart-item-price { color: var(--brand-color); font-weight: bold; }
.cart-item-qty { display: flex; align-items: center; gap: 10px; }
.qty-btn { width: 30px; height: 30px; border-radius: 15px; border: 1px solid #ccc; background: white; font-weight: bold; }