:root {
  font-family: 'M PLUS 1', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.5;
  font-weight: 400;

  color-scheme: light dark;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  /* ライトモード（デフォルト） */
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f5;
  --bg-tertiary: #e0e0e0;
  --bg-header-blue: #1976d2;
  --bg-header-orange: #ff9800;
  --bg-button-primary: #4CAF50;
  --bg-button-primary-hover: #45a049;
  --bg-button-secondary: #1976d2;
  --bg-button-disabled: #ccc;
  --bg-info: #e3f2fd;
  --bg-error: #ffebee;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  
  --text-primary: #213547;
  --text-secondary: #666;
  --text-tertiary: #999;
  --text-inverse: #ffffff;
  --text-error: #d32f2f;
  --text-error-dark: #c62828;
  
  --border-color: #ccc;
  --border-color-light: #ddd;
  --border-color-dark: #999;
  
  --shadow: rgba(0, 0, 0, 0.1);
}

a {
  font-weight: 500;
  color: #646cff;
  text-decoration: inherit;
}
a:hover {
  color: #535bf2;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background-color: #ffffff;
  color: #213547;
}

/* ライトモードを明示的に設定 */
@media (prefers-color-scheme: light) {
  body {
    background-color: #ffffff;
    color: #213547;
  }
}

h1 {
  font-size: 3.2em;
  line-height: 1.1;
}

button {
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0.6em 1.2em;
  font-size: 1em;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.25s, background-color 0.25s;
}
button:hover {
  border-color: #646cff;
}
button:focus,
button:focus-visible {
  outline: none;
}

/* 入力要素のフォントを統一 */
input,
textarea {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

/* ダークモードでもライトモードと同じ色を使用 */
@media (prefers-color-scheme: dark) {
  body {
    background-color: #ffffff;
    color: #213547;
  }
}

/* スマホブラウザ向け（PC幅には影響しない） */
@media (max-width: 768px) {
  html,
  body {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
  }

  button,
  a,
  input,
  textarea {
    -webkit-tap-highlight-color: transparent;
  }

  /* iOSの入力フォーカス時ズーム抑制の補助 */
  input,
  textarea {
    font-size: 16px;
  }

  /* ルーム作成: 問題文・詳細シナリオのスクロールバーを見やすくする */
  .scenario-textarea-mobile {
    scrollbar-width: thin;
    scrollbar-color: #999 #e8e8e8;
  }

  .scenario-textarea-mobile::-webkit-scrollbar {
    width: 8px;
    -webkit-appearance: none;
  }

  .scenario-textarea-mobile::-webkit-scrollbar-track {
    background: #e8e8e8;
    border-radius: 4px;
  }

  .scenario-textarea-mobile::-webkit-scrollbar-thumb {
    background: #999;
    border-radius: 4px;
  }
}
