:root {
  --primary: #FF69B4;
  --primary-light: #FF8AC4;
  --primary-dark: #E91E73;
  --bg: #FFF0F5;
  --card-bg: #FFFFFF;
  --text: #4A2D3A;
  --text-secondary: #B58A9A;
  --border: #FCE4EC;
  --shadow: 0 2px 12px rgba(255, 105, 180, 0.1);
  --radius: 16px;
  --sidebar-w: 68px;
  --sidebar-w-expand: 200px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --pink-grad: linear-gradient(135deg, #FFF0F5, #FFE4F0);
  --pink-shadow: rgba(255, 105, 180, 0.3);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  user-select: none;
  -webkit-user-select: none;
}

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #FF69B4 0%, #FF8AC4 50%, #FF4081 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0;
  flex-shrink: 0;
  z-index: 100;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  box-shadow: 2px 0 12px rgba(255, 105, 180, 0.2);
}

.sidebar.expanded {
  width: var(--sidebar-w-expand);
}

.sidebar-logo {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 20px;
  flex-shrink: 0;
  backdrop-filter: blur(4px);
  cursor: pointer;
}

.sidebar.expanded .sidebar-logo {
  width: 48px;
  height: 48px;
  margin-left: 0;
}

.nav-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px 0;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.75);
  transition: all 0.25s ease;
  position: relative;
  white-space: nowrap;
}

.nav-item .nav-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.25s ease;
}

.nav-item .nav-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item .nav-label {
  font-size: 11px;
  margin-left: 0;
  opacity: 0;
  transition: opacity 0.2s ease 0.1s;
  font-weight: 500;
}

.sidebar.expanded .nav-item {
  justify-content: flex-start;
  padding: 12px 16px;
}

.sidebar.expanded .nav-item .nav-label {
  opacity: 1;
  margin-left: 12px;
  font-size: 14px;
}

.nav-item.active {
  color: #FFF;
  background: rgba(255, 255, 255, 0.2);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 28px;
  background: #FFF;
  border-radius: 0 4px 4px 0;
}

.nav-item:active .nav-icon {
  transform: scale(0.9);
}

.sidebar-toggle {
  margin-top: auto;
  width: 44px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  transition: transform 0.3s ease;
  flex-shrink: 0;
}

.sidebar.expanded .sidebar-toggle {
  transform: rotate(180deg);
}

.sidebar-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ===== Main Content ===== */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.header {
  padding: 14px 20px 10px;
  flex-shrink: 0;
  z-index: 10;
  background: var(--bg);
}

.header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.header p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 16px 100px;
}

/* ===== Views ===== */
.view {
  display: none;
  animation: fadeIn 0.3s ease;
}

.view.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Category Tabs ===== */
.category-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 0 12px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.category-bar::-webkit-scrollbar {
  display: none;
}

.cat-tab {
  flex-shrink: 0;
  padding: 7px 16px;
  border-radius: 20px;
  background: var(--card-bg);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1.5px solid var(--border);
  white-space: nowrap;
}

.cat-tab.active {
  background: var(--primary);
  color: #FFF;
  border-color: var(--primary);
  box-shadow: 0 2px 8px var(--pink-shadow);
}

.cat-tab:active {
  transform: scale(0.95);
}

/* ===== Recipe Cards ===== */
.recipe-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.recipe-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 12px;
  align-items: flex-start;
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.recipe-card:active {
  transform: scale(0.98);
}

.recipe-emoji {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--pink-grad);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  flex-shrink: 0;
}

.recipe-info {
  flex: 1;
  min-width: 0;
}

.recipe-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.recipe-name .spicy-tag {
  font-size: 12px;
  padding: 1px 6px;
  border-radius: 6px;
  font-weight: 400;
}

.spicy-tag.none { background: #E8F5E9; color: #4CAF50; }
.spicy-tag.mild { background: #FFF3E0; color: #FF9800; }
.spicy-tag.hot { background: #FFEBEE; color: #F44336; }
.spicy-tag.warm { background: #FFF8E1; color: #FFA000; }
.spicy-tag.ice { background: #E3F2FD; color: #1976D2; }

.recipe-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 3px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.recipe-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.recipe-price {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}

.recipe-price .yen {
  font-size: 13px;
  font-weight: 500;
}

.add-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--primary);
  color: #FFF;
  border: none;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  box-shadow: 0 2px 8px var(--pink-shadow);
}

.add-btn:active {
  transform: scale(0.88);
  background: var(--primary-dark);
}

/* ===== Detail Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(74, 45, 58, 0.45);
  z-index: 200;
  display: none;
  align-items: flex-end;
  justify-content: center;
  animation: overlayIn 0.25s ease;
}

.modal-overlay.show {
  display: flex;
}

@keyframes overlayIn {
  from { background: rgba(74,45,58,0); }
  to { background: rgba(74,45,58,0.45); }
}

.modal {
  background: var(--card-bg);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 20px 20px calc(20px + var(--safe-bottom));
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-handle {
  width: 36px;
  height: 4px;
  background: #F8D7E5;
  border-radius: 2px;
  margin: 0 auto 16px;
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.modal-emoji {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--pink-grad);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
}

.modal-price {
  font-size: 15px;
  color: var(--primary);
  font-weight: 600;
  margin-top: 2px;
}

.modal-close {
  margin-left: auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #FFF0F5;
  border: none;
  font-size: 18px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.section-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 16px 0 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ingredients-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ingredient-chip {
  background: #FFF5F9;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px;
  color: var(--text);
}

.steps-list {
  counter-reset: step;
  list-style: none;
}

.steps-list li {
  position: relative;
  padding-left: 32px;
  margin-bottom: 10px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
}

.steps-list li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  color: #FFF;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== Spicy Selector ===== */
.spicy-selector {
  display: flex;
  gap: 10px;
  margin: 8px 0 16px;
}

.spicy-option {
  flex: 1;
  padding: 14px 8px;
  border-radius: 12px;
  border: 2px solid var(--border);
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--card-bg);
}

.spicy-option .spicy-emoji {
  font-size: 24px;
  display: block;
  margin-bottom: 4px;
}

.spicy-option .spicy-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.spicy-option.selected {
  border-color: var(--primary);
  background: #FFF0F5;
  transform: scale(1.03);
}

.spicy-option:active {
  transform: scale(0.96);
}

.modal-action-btn {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: none;
  background: var(--primary);
  color: #FFF;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 8px;
  box-shadow: 0 4px 12px var(--pink-shadow);
}

.modal-action-btn:active {
  transform: scale(0.97);
}

.modal-action-btn:disabled {
  background: #D4C4CC;
  box-shadow: none;
}

/* ===== Cart Bar ===== */
.cart-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card-bg);
  padding: 10px 16px calc(10px + var(--safe-bottom));
  display: none;
  align-items: center;
  gap: 12px;
  box-shadow: 0 -2px 16px rgba(255, 105, 180, 0.08);
  z-index: 50;
  animation: slideUpBar 0.3s ease;
}

.cart-bar.show {
  display: flex;
}

@keyframes slideUpBar {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.cart-icon-wrap {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cart-icon-wrap svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: #FFF;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cart-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  background: #F44336;
  color: #FFF;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border: 2px solid var(--card-bg);
}

.cart-info {
  flex: 1;
}

.cart-total {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.cart-total .yen {
  font-size: 14px;
}

.cart-count {
  font-size: 12px;
  color: var(--text-secondary);
}

.cart-submit-btn {
  padding: 12px 24px;
  border-radius: 12px;
  border: none;
  background: var(--primary);
  color: #FFF;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.cart-submit-btn:active {
  transform: scale(0.95);
}

.cart-submit-btn:disabled {
  background: #D4C4CC;
}

/* ===== Cart Drawer ===== */
.cart-drawer {
  position: fixed;
  inset: 0;
  background: rgba(74, 45, 58, 0.45);
  z-index: 200;
  display: none;
  align-items: flex-end;
}

.cart-drawer.show {
  display: flex;
}

.cart-drawer-content {
  background: var(--card-bg);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 75vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 20px 20px calc(20px + var(--safe-bottom));
}

.cart-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.cart-drawer-title {
  font-size: 18px;
  font-weight: 700;
}

.cart-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.cart-item-emoji {
  font-size: 26px;
  width: 40px;
  text-align: center;
  flex-shrink: 0;
}

.cart-item-info {
  flex: 1;
  min-width: 0;
}

.cart-item-name {
  font-size: 15px;
  font-weight: 600;
}

.cart-item-spicy {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.cart-item-price {
  font-size: 15px;
  font-weight: 600;
  color: var(--primary);
  text-align: right;
}

.cart-item-qty {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.qty-btn {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--card-bg);
  font-size: 16px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.qty-btn:active {
  transform: scale(0.9);
  border-color: var(--primary);
  color: var(--primary);
}

.qty-num {
  font-size: 15px;
  font-weight: 600;
  min-width: 24px;
  text-align: center;
}

.cart-empty {
  text-align: center;
  padding: 40px 0;
  color: var(--text-secondary);
}

.cart-empty .emoji {
  font-size: 48px;
  margin-bottom: 12px;
}

/* ===== Account Book ===== */
.stat-cards {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  flex: 1;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.stat-card .stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
}

.stat-card.primary .stat-value {
  color: var(--primary);
}

.stat-card .stat-value .yen {
  font-size: 16px;
  font-weight: 500;
}

.account-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.account-item {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 14px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 12px;
}

.account-item .acct-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--pink-grad);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.account-item .acct-info {
  flex: 1;
  min-width: 0;
}

.account-item .acct-date {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.account-item .acct-items {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.account-item .acct-amount {
  font-size: 17px;
  font-weight: 700;
  color: var(--primary);
  flex-shrink: 0;
}

.account-item .acct-amount .yen {
  font-size: 13px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-state .emoji {
  font-size: 56px;
  margin-bottom: 16px;
  display: block;
}

.empty-state .title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.empty-state .desc {
  font-size: 13px;
}

/* ===== Orders ===== */
.order-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}

.order-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--border);
}

.order-time {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.order-no {
  font-size: 11px;
  color: var(--text-secondary);
  background: #FFF5F9;
  padding: 2px 8px;
  border-radius: 6px;
}

.order-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.order-item-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.order-item-row .item-emoji {
  font-size: 20px;
  width: 28px;
  text-align: center;
}

.order-item-row .item-name {
  flex: 1;
  font-weight: 500;
}

.order-item-row .item-spicy {
  font-size: 11px;
  color: var(--text-secondary);
}

.order-item-row .item-qty {
  color: var(--text-secondary);
  font-size: 13px;
}

.order-item-row .item-price {
  font-weight: 600;
  color: var(--text);
}

.order-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.order-total-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.order-total {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
}

.order-total .yen {
  font-size: 14px;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(74, 45, 58, 0.92);
  color: #FFF;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 300;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
  backdrop-filter: blur(8px);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-8px);
}

/* ===== Responsive ===== */
@media (min-width: 768px) {
  .sidebar {
    width: var(--sidebar-w-expand);
  }
  .sidebar .nav-item {
    justify-content: flex-start;
    padding: 12px 16px;
  }
  .sidebar .nav-item .nav-label {
    opacity: 1;
    margin-left: 12px;
    font-size: 14px;
  }
  .sidebar-toggle {
    display: none;
  }
  .content {
    max-width: 600px;
    margin: 0 auto;
  }
}

/* ===== Install Prompt ===== */
.install-prompt {
  position: fixed;
  bottom: -100px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 24px);
  max-width: 420px;
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(255, 105, 180, 0.25);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 150;
  transition: bottom 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.install-prompt.show {
  bottom: 16px;
}

.install-prompt-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--pink-grad);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.install-prompt-text {
  flex: 1;
  min-width: 0;
}

.install-prompt-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.install-prompt-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.install-prompt-btn {
  padding: 8px 18px;
  border-radius: 10px;
  border: none;
  background: var(--primary);
  color: #FFF;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 2px 8px var(--pink-shadow);
  transition: all 0.2s ease;
}

.install-prompt-btn:active {
  transform: scale(0.92);
}

.install-prompt-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: #FFF0F5;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
}
