:root {
  --bg: #f3f4f6;
  --card: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --muted: #6b7280;
  --primary: #1f2937;
  --primary-hover: #111827;
  --accent: #2563eb;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: rgba(37, 99, 235, 0.1); }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 16px 10px 40px;
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
.container { max-width: 720px; margin: 0 auto; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.app-title { font-size: 17px; font-weight: 700; margin: 0; }
.app-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.input {
  width: 100%;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 16px;
  background: #fafafa;
  -webkit-appearance: none;
  appearance: none;
}
.input:focus { outline: 2px solid var(--accent); background: #fff; }
.btn {
  display: inline-block;
  padding: 16px 20px;
  border: none;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  width: 100%;
  text-decoration: none;
  min-height: 48px;
  -webkit-appearance: none;
  appearance: none;
  touch-action: manipulation;
}
.btn:active { background: var(--primary-hover); transform: scale(0.98); }
.btn.secondary { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn.danger { background: var(--danger); }
.btn.small { padding: 10px 14px; font-size: 13px; width: auto; min-height: 40px; }
.btn-row { display: flex; gap: 10px; margin-top: 16px; }
.btn-row .btn { flex: 1; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.pin-message { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 20px; }

.day-block {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 10px;
  overflow: hidden;
}
.day-block.warn { border-color: #fde68a; }
.day-header {
  display: flex;
  align-items: center;
  padding: 14px 12px;
  background: #fafafa;
  cursor: pointer;
  user-select: none;
  min-height: 56px;
  touch-action: manipulation;
}
.day-header.warn { background: #fffbeb; }
.day-header input[type="checkbox"] {
  width: 22px;
  height: 22px;
  margin-right: 12px;
  cursor: pointer;
  flex-shrink: 0;
}
.day-date { font-weight: 600; flex: 1; font-size: 14px; min-width: 0; }
.day-count {
  font-size: 11px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3px 10px;
  flex-shrink: 0;
  white-space: nowrap;
}
.shift-list { padding: 4px 10px 10px; background: #fff; }

.shift-item {
  display: flex;
  align-items: center;
  padding: 10px 4px 10px 8px;
  color: var(--text);
  font-size: 14px;
  border-bottom: 1px solid #f3f4f6;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 44px;
}
.shift-item:last-child { border-bottom: none; }
label.shift-item:active { background: #f3f4f6; }
.shift-item input[type="checkbox"] {
  width: 22px;
  height: 22px;
  margin-right: 12px;
  flex-shrink: 0;
}
.shift-time {
  font-family: "SF Mono", Monaco, monospace;
  color: var(--muted);
  font-size: 12px;
  width: 110px;
  flex-shrink: 0;
}
.shift-name { flex: 1; min-width: 0; word-break: break-all; }
.tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 6px;
  font-weight: 500;
  flex-shrink: 0;
  white-space: nowrap;
}
.tag-skip { background: #fef3c7; color: #92400e; }
.tag-unmatched { background: #fee2e2; color: #991b1b; }
.tag-temp { background: #e5e7eb; color: var(--muted); }
.tag-info { background: #dbeafe; color: #1e40af; }
.tag-dry { background: #ede9fe; color: #5b21b6; }
.shift-item.dim { opacity: 0.55; }

.alert {
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 16px;
  line-height: 1.6;
}
.alert-warn { background: #fef3c7; border: 1px solid #fde68a; color: #92400e; }
.alert-info { background: #dbeafe; border: 1px solid #bfdbfe; color: #1e40af; }
.alert-success { background: #d1fae5; border: 1px solid #a7f3d0; color: #065f46; }
.alert-danger { background: #fee2e2; border: 1px solid #fecaca; color: #991b1b; }

.summary-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 14px; border-bottom: 1px solid var(--border); }
.summary-row:last-child { border-bottom: none; }
.summary-label { color: var(--muted); }
.summary-value { font-weight: 600; font-family: "SF Mono", Monaco, monospace; }

.result-stat {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 16px;
}
.stat-box {
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 4px;
  text-align: center;
}
.stat-num { font-size: 22px; font-weight: 700; line-height: 1.1; }
.stat-label { font-size: 10px; color: var(--muted); margin-top: 4px; line-height: 1.2; }
.stat-box.ok .stat-num { color: var(--success); }
.stat-box.fail .stat-num { color: var(--danger); }
.stat-box.skip .stat-num { color: var(--warning); }
.stat-box.info .stat-num { color: var(--accent); }

.result-day { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 8px; }
.result-day-head {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.result-line {
  font-size: 13px;
  padding: 6px 0 6px 8px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}
.icon { width: 20px; display: inline-block; flex-shrink: 0; }
.icon-ok { color: var(--success); }
.icon-fail { color: var(--danger); }
.icon-skip { color: var(--warning); }

.footer-note { margin-top: 24px; text-align: center; color: var(--muted); font-size: 11px; }

.progress-wrap { padding: 30px 20px; text-align: center; }
.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #e5e7eb;
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 20px;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.dry-banner {
  background: #ede9fe;
  color: #5b21b6;
  border: 1px solid #ddd6fe;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 12px;
  font-size: 13px;
  text-align: center;
  font-weight: 600;
}
.error-banner {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 13px;
}

/* スマホ向け追加調整 */
@media (max-width: 480px) {
  body { padding: 8px 6px 24px; font-size: 14px; }
  .card { padding: 16px 12px; border-radius: 10px; }
  .app-title { font-size: 16px; }
  .alert { font-size: 12px; padding: 10px 12px; }
  .shift-time { width: 100px; font-size: 11px; }
  .shift-name { font-size: 14px; }
  .day-date { font-size: 13px; }
  .stat-num { font-size: 20px; }
  .stat-label { font-size: 10px; }
  .result-day { padding: 10px 12px; }
  .btn { padding: 14px 16px; font-size: 15px; }
  .btn-row { gap: 8px; }
  .footer-note { font-size: 10px; }
}

@media (max-width: 360px) {
  .shift-time { width: 92px; font-size: 11px; }
  .shift-name { font-size: 13px; }
  .day-count { font-size: 10px; padding: 2px 8px; }
}
