/* ===========================================
   宮平医院 待ち人数表示 — 患者ページ CSS
   =========================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  touch-action: manipulation;
}

:root {
  --color-bg-start: #0a1628;
  --color-bg-end: #1a2a4a;
  --color-primary: #4da6ff;
  --color-primary-glow: rgba(77, 166, 255, 0.3);
  --color-accent: #36d6b5;
  --color-text: #e8f0fe;
  --color-text-muted: rgba(232, 240, 254, 0.5);
  --color-card-bg: rgba(255, 255, 255, 0.06);
  --color-card-border: rgba(255, 255, 255, 0.1);
  --font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
}

html {
  font-size: 16px;
}

body {
  font-family: var(--font-family);
  background: linear-gradient(145deg, var(--color-bg-start), var(--color-bg-end));
  color: var(--color-text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

/* --- 背景のオーブアニメーション --- */
.bg-orbs {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
}

.orb-1 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #4da6ff 0%, transparent 70%);
  top: -100px;
  right: -100px;
  animation: float-1 12s ease-in-out infinite;
}

.orb-2 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, #36d6b5 0%, transparent 70%);
  bottom: -80px;
  left: -80px;
  animation: float-2 15s ease-in-out infinite;
}

.orb-3 {
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, #a78bfa 0%, transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: float-3 18s ease-in-out infinite;
}

@keyframes float-1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-40px, 30px) scale(1.1); }
  66% { transform: translate(20px, -20px) scale(0.95); }
}

@keyframes float-2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -25px) scale(0.9); }
  66% { transform: translate(-20px, 15px) scale(1.05); }
}

@keyframes float-3 {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-45%, -55%) scale(1.15); }
}

/* --- メインコンテナ --- */
.container {
  position: relative;
  z-index: 1;
  text-align: center;
  width: 100%;
  max-width: 480px;
  padding: 2rem 1.5rem;
}

/* --- ヘッダー --- */
.clinic-header {
  margin-bottom: 2.5rem;
}

.clinic-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  color: var(--color-primary);
}

.clinic-icon svg {
  width: 100%;
  height: 100%;
}

.clinic-name {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--color-text);
}

/* --- メインカード --- */
.card {
  background: var(--color-card-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--color-card-border);
  border-radius: 24px;
  padding: 3rem 2rem;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.card-label {
  font-size: 1rem;
  font-weight: 400;
  color: var(--color-text-muted);
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
}

/* --- カウント表示 --- */
.count-display {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.3rem;
  margin-bottom: 1.5rem;
}

.count-number {
  font-size: 7rem;
  font-weight: 900;
  line-height: 1;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 0 30px var(--color-primary-glow));
}

.count-number.bump {
  transform: scale(1.15);
}

.count-unit {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-text-muted);
  margin-left: 0.25rem;
}

/* --- ステータスバー --- */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fbbf24;
  transition: background 0.3s;
}

.status-dot.connected {
  background: #34d399;
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.5);
  animation: pulse-dot 2s ease-in-out infinite;
}

.status-dot.disconnected {
  background: #f87171;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.status-text {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.last-updated {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 1rem;
}

/* --- メッセージエリア --- */
.message-area {
  margin-top: 2rem;
  min-height: 2rem;
}

.message-text {
  font-size: 1rem;
  color: var(--color-text-muted);
  font-weight: 400;
  letter-spacing: 0.04em;
  animation: fade-in 0.5s ease;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- 非表示 --- */
.hidden {
  display: none !important;
}

/* --- 診療中バッジ --- */
.clinic-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.25);
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #34d399;
  margin-bottom: 1.5rem;
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d399;
  animation: pulse-dot 2s ease-in-out infinite;
}

/* --- 閉院カード --- */
.card-closed {
  text-align: center;
  padding: 3rem 2rem;
}

.closed-icon {
  font-size: 3.5rem;
  margin-bottom: 1.5rem;
  animation: fade-in 0.6s ease;
}

.closed-title {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--color-text);
  line-height: 1.6;
  margin-bottom: 1.5rem;
  animation: fade-in 0.6s ease 0.1s both;
}

.closed-sub {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  line-height: 1.8;
  animation: fade-in 0.6s ease 0.2s both;
}

/* --- フッター --- */
.footer {
  margin-top: 3rem;
}

.footer p {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  opacity: 0.6;
}

/* --- レスポンシブ --- */
@media (max-width: 480px) {
  .container {
    padding: 1.5rem 1rem;
  }

  .count-number {
    font-size: 5.5rem;
  }

  .count-unit {
    font-size: 1.6rem;
  }

  .card {
    padding: 2.5rem 1.5rem;
    border-radius: 20px;
  }
}

@media (min-width: 768px) {
  .count-number {
    font-size: 9rem;
  }
}
