/* ボタン */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  border-radius: var(--radius-lg);
  font-size: var(--font-base);
  font-weight: bold;
  min-height: 48px;
  min-width: 44px;
  transition: transform var(--transition-fast), background var(--transition-fast),
    box-shadow var(--transition-fast);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.96);
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: white;
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  box-shadow: var(--shadow-lg);
}

.btn-danger {
  background: linear-gradient(135deg, var(--color-accent), #c0392b);
  color: white;
  box-shadow: var(--shadow-md);
}

.btn-outline {
  border: 2px solid var(--color-primary);
  color: var(--color-primary);
}

.btn-outline:hover {
  background: var(--color-primary);
  color: white;
}

.btn-ghost {
  color: var(--text-secondary);
  padding: var(--space-sm) var(--space-md);
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.btn-lg {
  font-size: var(--font-lg);
  padding: var(--space-lg) var(--space-2xl);
  min-height: 56px;
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* カード */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
}

.card-bordered {
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* 入力欄 */
.input {
  width: 100%;
  padding: var(--space-md);
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--font-lg);
  text-align: center;
  letter-spacing: 0.15em;
  transition: border-color var(--transition-fast);
  min-height: 48px;
}

.input::placeholder {
  color: var(--text-muted);
  letter-spacing: 0.05em;
  font-size: var(--font-sm);
}

.input:focus {
  border-color: var(--color-primary);
  outline: none;
  background: rgba(255, 255, 255, 0.12);
}

.input-error {
  border-color: var(--color-accent);
}

/* エラーメッセージ */
.error-text {
  color: var(--color-accent);
  font-size: var(--font-sm);
  min-height: 1.4em;
}

/* HPバー */
.hp-bar-container {
  width: 100%;
  height: 20px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.hp-bar {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.5s ease-out, background-color 0.3s ease;
  background: var(--hp-high);
}

.hp-bar.medium {
  background: var(--hp-medium);
}

.hp-bar.low {
  background: var(--hp-low);
}

.hp-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 12px;
  font-weight: bold;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
}

/* ステータス表示 */
.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-xs) 0;
}

.stat-label {
  color: var(--text-secondary);
  font-size: var(--font-sm);
}

.stat-value {
  font-weight: bold;
  font-size: var(--font-base);
  font-variant-numeric: tabular-nums;
}

/* キャラクターカード */
.character-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}

.character-name {
  font-size: var(--font-lg);
  font-weight: bold;
  text-align: center;
}

.character-serial {
  font-size: var(--font-sm);
  color: var(--text-muted);
  font-family: monospace;
}

/* バッジ */
.badge {
  display: inline-block;
  padding: 2px var(--space-sm);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: bold;
}

.badge-special {
  background: var(--text-accent);
  color: var(--bg-dark);
}

.badge-new {
  background: var(--color-success);
  color: white;
}

.badge-old {
  background: var(--text-muted);
  color: white;
}

/* 区切り線 */
.divider {
  width: 100%;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: var(--space-sm) 0;
}

/* ローディング */
.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* カメラオーバーレイ */
.camera-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #000;
  animation: fadeIn 0.2s ease-out;
}

.camera-overlay video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
}

.camera-guide {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 85%;
  height: 12%;
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius-md);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.camera-guide-label {
  position: absolute;
  top: -32px;
  left: 0;
  right: 0;
  text-align: center;
  color: white;
  font-size: var(--font-sm);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
}

.camera-scan-indicator {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.camera-scan-line {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--color-primary), transparent);
  opacity: 0;
  will-change: transform;
}

.camera-scan-line.scanning {
  opacity: 1;
  animation: scanSweep 1.2s ease-in-out;
}

.camera-status {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  color: white;
  font-size: var(--font-sm);
  padding: var(--space-lg);
  padding-bottom: calc(var(--space-lg) + env(safe-area-inset-bottom, 0px));
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
  background: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent);
}

.camera-close-btn {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  top: calc(var(--space-md) + env(safe-area-inset-top, 0px));
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: white;
  font-size: var(--font-sm);
  font-weight: bold;
  border: 1px solid rgba(255, 255, 255, 0.2);
  min-height: 44px;
  min-width: 44px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
