:root {
  --ios-blue: #007AFF;
  --ios-bg: #F2F2F7;
  --card-bg: #FFFFFF;
  --text-primary: #1C1C1E;
  --text-secondary: #8E8E93;
  --separator: #E5E5EA;
  --destructive: #FF3B30;
  --success: #34C759;
  --nav-height: 60px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--ios-bg);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ── */
.page {
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
  padding-top: env(safe-area-inset-top, 0px);
}

.page-header {
  padding: 20px 20px 8px;
}

.page-title {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin: 0;
}

/* ── Bottom Nav ── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-height) + var(--safe-bottom));
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--separator);
  display: flex;
  align-items: flex-start;
  padding-top: 8px;
  padding-bottom: var(--safe-bottom);
  z-index: 100;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 500;
  transition: color 0.15s;
}

.nav-item.active {
  color: var(--ios-blue);
}

.nav-icon {
  font-size: 22px;
  line-height: 1;
}

/* ── Cards ── */
.card {
  background: var(--card-bg);
  border-radius: 16px;
  margin: 12px 16px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.card-content {
  padding: 20px;
}

/* ── Today Spot ── */
.spot-display {
  text-align: center;
  padding: 40px 20px;
}

.spot-number {
  font-size: 88px;
  font-weight: 800;
  color: var(--ios-blue);
  line-height: 1;
  letter-spacing: -3px;
  margin: 0;
}

.spot-label {
  font-size: 17px;
  color: var(--text-secondary);
  margin: 8px 0 0;
}

.spot-date {
  font-size: 15px;
  color: var(--text-secondary);
  margin: 4px 0 0;
}

.no-spot {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-secondary);
}

.no-spot-icon {
  font-size: 64px;
  margin-bottom: 12px;
}

.no-spot-text {
  font-size: 17px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 600;
  font-family: inherit;
  padding: 14px 24px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  text-decoration: none;
  -webkit-user-select: none;
}

.btn:active {
  opacity: 0.75;
  transform: scale(0.97);
}

.btn-primary {
  background: var(--ios-blue);
  color: white;
  width: 100%;
}

.btn-secondary {
  background: var(--separator);
  color: var(--text-primary);
}

.btn-destructive {
  background: transparent;
  color: var(--destructive);
}

.btn:disabled {
  opacity: 0.4;
  cursor: default;
  transform: none;
}

/* ── Scanner ── */
.scan-area {
  padding: 20px;
}

.photo-preview {
  width: 100%;
  max-height: 340px;
  object-fit: contain;
  border-radius: 12px;
  display: none;
  margin-bottom: 16px;
  background: var(--ios-bg);
}

.photo-preview.visible {
  display: block;
}

.file-input-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 2px dashed var(--ios-blue);
  border-radius: 16px;
  padding: 48px 20px;
  cursor: pointer;
  color: var(--ios-blue);
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 16px;
  transition: background 0.15s;
}

.file-input-label:active {
  background: rgba(0, 122, 255, 0.08);
}

.file-input-label .icon {
  font-size: 48px;
}

#file-input {
  display: none;
}

/* ── Result Banner ── */
.result-banner {
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  display: none;
  align-items: center;
  gap: 12px;
  font-weight: 500;
}

.result-banner.success {
  background: rgba(52, 199, 89, 0.12);
  color: #1A7A32;
  display: flex;
}

.result-banner.error {
  background: rgba(255, 59, 48, 0.12);
  color: #CC2222;
  display: flex;
}

/* ── Spinner ── */
.spinner {
  display: none;
  text-align: center;
  padding: 20px;
  color: var(--text-secondary);
}

.spinner.visible {
  display: block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner-circle {
  width: 32px;
  height: 32px;
  border: 3px solid var(--separator);
  border-top-color: var(--ios-blue);
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.7s linear infinite;
}

/* ── Settings ── */
.settings-group {
  margin: 0 16px 8px;
}

.settings-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0 4px 6px;
}

.settings-row {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--separator);
  background: var(--card-bg);
}

.settings-row:first-of-type {
  border-radius: 16px 16px 0 0;
}

.settings-row:last-of-type {
  border-bottom: none;
  border-radius: 0 0 16px 16px;
}

.settings-row:only-of-type {
  border-radius: 16px;
}

.settings-row label {
  font-size: 17px;
  flex: 1;
}

.settings-input {
  font-size: 17px;
  font-family: inherit;
  border: none;
  outline: none;
  text-align: right;
  color: var(--text-secondary);
  background: transparent;
  flex: 2;
  min-width: 0;
}

.settings-input::placeholder {
  color: var(--separator);
}

select.settings-input {
  -webkit-appearance: none;
  cursor: pointer;
}

/* ── Install Banner ── */
.install-banner {
  margin: 12px 16px;
  background: linear-gradient(135deg, rgba(0,122,255,0.1), rgba(0,122,255,0.05));
  border: 1px solid rgba(0,122,255,0.2);
  border-radius: 14px;
  padding: 16px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
}

.install-banner strong {
  color: var(--ios-blue);
}

/* ── History ── */
.history-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--separator);
  gap: 12px;
}

.history-item:last-child {
  border-bottom: none;
}

.history-spot {
  font-size: 22px;
  font-weight: 700;
  color: var(--ios-blue);
  min-width: 56px;
}

.history-date {
  font-size: 15px;
  color: var(--text-secondary);
  flex: 1;
}

.history-delete {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px;
}
