* { box-sizing: border-box; }
html, body {
  margin: 0;
  width: 100%;
  overflow-x: hidden;
}
body {
  font-family: -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;
  background: #111827;
  color: #f3f4f6;
  height: 100vh;
  overflow: hidden;
}
.hidden { display: none !important; }

.screen { height: 100vh; width: 100vw; }

/* ---- setup ---- */
#setup-screen { display: flex; align-items: center; justify-content: center; }
.setup-box {
  background: #1f2937;
  padding: 2rem;
  border-radius: 1rem;
  width: min(90vw, 420px);
  text-align: center;
}
.setup-box input {
  width: 100%;
  padding: 0.75rem;
  font-size: 1.1rem;
  margin: 1rem 0;
  border-radius: 0.5rem;
  border: none;
}
.setup-box button {
  width: 100%;
  padding: 0.75rem;
  font-size: 1.1rem;
  border-radius: 0.5rem;
  border: none;
  background: #2563eb;
  color: white;
}
.error { color: #f87171; min-height: 1.2rem; }

/* ---- main layout ---- */
#main-screen { display: flex; flex-direction: column; height: 100vh; width: 100%; overflow: hidden; }
.panels {
  flex: 1;
  display: flex;
  overflow: hidden;
  transition: transform 0.25s ease;
  /* モバイル既定: 2画面分の横長トラック(200%)。各.panelは50%=トラックの半分=ビューポート全幅 */
  width: 200%;
}
.panel {
  flex: 0 0 auto;
  width: 50%;
  height: 100%;
  padding: 1.5rem;
  overflow-y: auto;
  overflow-x: hidden;
}
#panel-punch { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; }

.clock { font-size: clamp(2rem, 8vw, 3.5rem); font-variant-numeric: tabular-nums; }

.big-button {
  font-size: clamp(1.5rem, 6vw, 2.5rem);
  padding: 1.5rem 3rem;
  border-radius: 2rem;
  border: none;
  background: #2563eb;
  color: white;
  width: min(90%, 480px);
}
.big-button:active { background: #1d4ed8; }
.big-button.nfc-retry {
  background: #f59e0b;
  color: #111827;
  font-weight: 700;
  animation: nfc-pulse 1.6s ease-in-out infinite;
}
.big-button.nfc-retry:active { background: #d97706; animation: none; }
@keyframes nfc-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, .55); }
  50% { box-shadow: 0 0 0 16px rgba(245, 158, 11, 0); }
}

.badge {
  background: #f59e0b;
  color: #111827;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  font-size: 0.9rem;
}

.tap-list { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; max-width: 600px; }
.tap-list button {
  padding: 0.75rem 1.25rem;
  border-radius: 0.75rem;
  border: none;
  background: #374151;
  color: white;
  font-size: 1rem;
}
.tap-list button:active { background: #4b5563; }

.result { min-height: 2rem; font-size: 1.1rem; }
.result.ok { color: #34d399; }
.result.ng { color: #f87171; }

.rack-list { display: flex; flex-direction: column; gap: 0.5rem; }
.rack-item {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  background: #1f2937;
}
.rack-item.in { border-left: 4px solid #34d399; }
.rack-item.out { border-left: 4px solid #6b7280; }
.rack-item.warning { border-left: 4px solid #f59e0b; }

.swipe-toggle {
  display: block;
  width: 100%;
  padding: 0.75rem;
  border: none;
  background: #374151;
  color: white;
  font-size: 1rem;
  flex-shrink: 0;
}

/* ---- ブレークポイント: 768px未満=スマホ(1画面ずつスワイプ) / 以上=タブレット・PC(2カラム同居) ---- */
@media (min-width: 768px) {
  .panels {
    width: 100%;
    flex-wrap: nowrap;
    transform: none !important; /* JSが設定したスワイプ位置を無効化しリグレッションを防ぐ */
  }
  .panel { width: 50%; }
  #panel-rack { border-left: 1px solid #374151; }
  .swipe-toggle { display: none; }
}
