/* ==========================================
   土地活用スケール換算アプリ - デザインシステム
   ========================================== */

/* === リセット & ベース === */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* カラーパレット */
  --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --bg-dark: #0f0f23;
  --bg-card: rgba(255, 255, 255, 0.05);
  --text-primary: #ffffff;
  --text-secondary: #b8b8d1;
  --accent-green: #10b981;
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-orange: #f59e0b;

  /* スペーシング */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;

  /* ボーダー */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;

  /* シャドウ */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 20px rgba(102, 126, 234, 0.4);
}

body {
  font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  padding: var(--spacing-md);
  background-image:
    radial-gradient(circle at 20% 50%, rgba(102, 126, 234, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(118, 75, 162, 0.1) 0%, transparent 50%);
  background-attachment: fixed;
}

/* === コンテナ === */
.container {
  max-width: 1200px;
  margin: 0 auto;
  animation: fadeIn 0.6s ease-out;
}

/* === ヘッダー === */
header {
  text-align: center;
  margin-bottom: var(--spacing-xl);
  padding: var(--spacing-lg) 0;
}

h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--spacing-sm);
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--text-secondary);
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  font-weight: 300;
}

/* === 入力セクション === */
.input-section {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-xl);
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
}

.input-section:hover {
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.input-group {
  display: flex;
  gap: var(--spacing-sm);
  align-items: stretch;
  flex-wrap: wrap;
}

.input-wrapper {
  flex: 1;
  min-width: 200px;
  position: relative;
}

input[type="number"] {
  width: 100%;
  padding: var(--spacing-md) var(--spacing-md);
  font-size: 1.2rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  transition: all 0.3s ease;
  font-family: inherit;
}

input[type="number"]:focus {
  outline: none;
  border-color: #667eea;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

input[type="number"]::placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
}

.unit-label {
  position: absolute;
  right: var(--spacing-md);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  font-weight: 600;
  pointer-events: none;
}

button {
  padding: var(--spacing-md) var(--spacing-xl);
  font-size: 1.1rem;
  font-weight: 700;
  background: var(--primary-gradient);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-md);
  white-space: nowrap;
  font-family: inherit;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

button:active {
  transform: translateY(0);
}

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

/* === 結果セクション === */
.results {
  display: none;
  animation: fadeInUp 0.6s ease-out;
}

.results.show {
  display: block;
}

.result-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
}

.result-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.result-card h2 {
  font-size: 1.5rem;
  margin-bottom: var(--spacing-md);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.result-card h3 {
  font-size: 1.2rem;
  margin: var(--spacing-md) 0 var(--spacing-sm) 0;
  color: var(--text-secondary);
}

/* === テーブル === */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: var(--spacing-sm);
}

th,
td {
  padding: var(--spacing-sm) var(--spacing-md);
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

th {
  background: rgba(102, 126, 234, 0.1);
  font-weight: 700;
  color: var(--text-secondary);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

td {
  font-size: 1.1rem;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

/* === リスト === */
.production-list {
  list-style: none;
  display: grid;
  gap: var(--spacing-md);
  margin-top: var(--spacing-sm);
}

.production-item {
  background: rgba(255, 255, 255, 0.03);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  border-left: 4px solid;
  transition: all 0.3s ease;
}

.production-item:nth-child(1) {
  border-left-color: var(--accent-green);
}

.production-item:nth-child(2) {
  border-left-color: var(--accent-orange);
}

.production-item:nth-child(3) {
  border-left-color: var(--accent-blue);
}

.production-item:nth-child(4) {
  border-left-color: var(--accent-purple);
}

.production-item:hover {
  background: rgba(255, 255, 255, 0.06);
  transform: translateX(4px);
}

.production-item strong {
  display: block;
  font-size: 1.1rem;
  margin-bottom: var(--spacing-xs);
}

.production-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent-green);
}

/* === 価格表示 === */
.price-grid {
  display: grid;
  gap: var(--spacing-md);
  margin-top: var(--spacing-sm);
}

.price-item {
  background: rgba(255, 255, 255, 0.03);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  transition: all 0.3s ease;
}

.price-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.price-label {
  display: block;
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: var(--spacing-xs);
}

.price-value {
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--secondary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* === アニメーション === */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* === レスポンシブ === */
@media (max-width: 768px) {
  body {
    padding: var(--spacing-sm);
  }

  .input-group {
    flex-direction: column;
  }

  .input-wrapper {
    min-width: 100%;
  }

  button {
    width: 100%;
  }

  table {
    font-size: 0.9rem;
  }

  th,
  td {
    padding: var(--spacing-xs) var(--spacing-sm);
  }
}

@media (min-width: 769px) {
  .price-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* === ユーティリティ === */
.text-center {
  text-align: center;
}

.mb-0 {
  margin-bottom: 0;
}

.mb-1 {
  margin-bottom: var(--spacing-sm);
}

.mb-2 {
  margin-bottom: var(--spacing-md);
}

.mb-3 {
  margin-bottom: var(--spacing-lg);
}

.mt-0 {
  margin-top: 0;
}

.mt-1 {
  margin-top: var(--spacing-sm);
}

.mt-2 {
  margin-top: var(--spacing-md);
}

.mt-3 {
  margin-top: var(--spacing-lg);
}

.text-secondary {
  color: var(--text-secondary);
}

/* === ビジュアル比較バー === */
.visual-comparison {
  margin-top: var(--spacing-lg);
  padding-top: var(--spacing-lg);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.visual-comparison h3 {
  font-size: 1.1rem;
  margin-bottom: var(--spacing-md);
  color: var(--text-primary);
}

.progress-bar-container {
  width: 100%;
  height: 40px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  border-radius: var(--radius-md);
  transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 20px rgba(102, 126, 234, 0.6);
  position: relative;
  overflow: hidden;
}

.progress-bar::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    left: -100%;
  }

  100% {
    left: 100%;
  }
}

.percent-text {
  margin-top: var(--spacing-sm);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent-purple);
  text-align: center;
}

/* === 極端な例リスト === */
.extreme-list {
  list-style: none;
  display: grid;
  gap: var(--spacing-md);
  margin-top: var(--spacing-sm);
}

.extreme-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  background: rgba(255, 255, 255, 0.03);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  transition: all 0.3s ease;
  opacity: 0;
  animation: slideInLeft 0.5s ease forwards;
}

.extreme-item:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateX(8px) scale(1.02);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.extreme-icon {
  font-size: 3rem;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.extreme-content {
  flex: 1;
}

.extreme-content strong {
  display: block;
  font-size: 1.1rem;
  margin-bottom: var(--spacing-xs);
  color: var(--text-primary);
}

.extreme-value {
  font-size: 1.4rem;
  font-weight: 700;
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--spacing-xs);
}

.extreme-note {
  font-size: 0.9rem;
  color: var(--text-secondary);
  opacity: 0.8;
}

/* === 追加アニメーション === */
@keyframes pulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }
}

.pulse {
  animation: pulse 2s ease-in-out infinite;
}

/* === ビジネスモード === */
.business-mode {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
  border: 2px solid rgba(102, 126, 234, 0.2);
}

.business-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--spacing-md);
  margin-top: var(--spacing-sm);
}

.business-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  transition: all 0.3s ease;
  opacity: 0;
  animation: fadeInScale 0.5s ease forwards;
}

.business-card:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 8px 24px rgba(102, 126, 234, 0.3);
  border-color: rgba(102, 126, 234, 0.4);
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.9);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.business-header {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
}

.business-emoji {
  font-size: 2.5rem;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.business-title {
  flex: 1;
}

.business-title strong {
  display: block;
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-bottom: var(--spacing-xs);
}

.business-description {
  font-size: 0.9rem;
  color: var(--text-secondary);
  opacity: 0.9;
}

.business-result {
  text-align: center;
  padding: var(--spacing-md) 0;
  margin: var(--spacing-md) 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.business-count {
  font-size: 1.8rem;
  font-weight: 800;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: inline-block;
}

.business-percentage {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-blue);
}

.business-detail {
  font-size: 0.85rem;
  color: var(--text-secondary);
  opacity: 0.8;
  text-align: center;
  line-height: 1.4;
}

/* レスポンシブ: ビジネスモード */
@media (max-width: 768px) {
  .business-list {
    grid-template-columns: 1fr;
  }
}

/* === ゲームモード（インタラクティブ塗りつぶし） === */
.game-mode {
  background: linear-gradient(135deg, rgba(240, 147, 251, 0.08) 0%, rgba(245, 87, 108, 0.08) 100%);
  border: 2px solid rgba(240, 147, 251, 0.3);
}

/* ゲーム情報パネル */
.game-info-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
}

.game-stat {
  background: rgba(0, 0, 0, 0.3);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  text-align: center;
  transition: all 0.3s ease;
}

.game-stat:hover {
  background: rgba(0, 0, 0, 0.4);
  transform: translateY(-2px);
}

.stat-label {
  display: block;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: var(--spacing-xs);
}

.stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* キャンバスコンテナ */
.canvas-container {
  background: #1a1a2e;
  border-radius: var(--radius-md);
  padding: var(--spacing-lg);
  margin: var(--spacing-lg) 0;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 400px;
}

#paintCanvas {
  border: 3px solid rgba(240, 147, 251, 0.5);
  border-radius: var(--radius-sm);
  cursor: crosshair;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  transition: all 0.3s ease;
}

#paintCanvas:hover {
  border-color: rgba(240, 147, 251, 0.8);
  box-shadow: 0 12px 32px rgba(240, 147, 251, 0.3);
}

/* 励ましメッセージ */
.encouragement-message {
  text-align: center;
  padding: var(--spacing-md);
  margin-top: var(--spacing-md);
  font-size: 1.2rem;
  font-weight: 700;
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: slideInUp 0.5s ease;
}

/* ゲームコントロール */
.game-controls {
  display: flex;
  gap: var(--spacing-md);
  justify-content: center;
  margin-top: var(--spacing-lg);
}

.game-btn {
  padding: var(--spacing-md) var(--spacing-xl);
  font-size: 1.1rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Outfit', sans-serif;
}

.game-btn.primary {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(240, 147, 251, 0.3);
}

.game-btn.primary:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(240, 147, 251, 0.5);
}

.game-btn.primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.game-btn.secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.game-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.3);
}

/* 結果パネル */
.game-result-panel {
  background: rgba(0, 0, 0, 0.3);
  border: 2px solid rgba(240, 147, 251, 0.5);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  margin-top: var(--spacing-lg);
  text-align: center;
  animation: slideInUp 0.5s ease;
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.game-result-panel h3 {
  font-size: 2rem;
  margin-bottom: var(--spacing-md);
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.game-result-panel p {
  font-size: 1.1rem;
  margin-bottom: var(--spacing-sm);
}

.game-result-panel strong {
  font-size: 1.5rem;
  color: var(--accent-purple);
}

.result-message {
  margin-top: var(--spacing-md);
  padding-top: var(--spacing-md);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 1rem;
  color: var(--text-secondary);
}

/* レスポンシブ: ゲームモード */
@media (max-width: 768px) {
  .game-info-panel {
    grid-template-columns: 1fr;
    gap: var(--spacing-sm);
  }

  .canvas-container {
    padding: var(--spacing-md);
    min-height: 300px;
  }

  #paintCanvas {
    max-width: 100%;
    height: auto;
  }

  .game-controls {
    flex-direction: column;
  }

  .game-btn {
    width: 100%;
  }
}