/* ==============================================================================
   数学ツールJP (bhartiyajobs.com) — MAIN STYLESHEET
   Design System: Charcoal Dark (Default) & Professional Light Mode
   Zero-overflow, accessible, high performance, native Japanese typography
   ============================================================================== */

:root {
  /* Dark Theme Palette (Default) */
  --bg-main: #16191E;
  --bg-secondary: #1C222A;
  --bg-card: #222A34;
  --bg-input: #293440;
  --bg-hover: #303D49;
  
  --text-main: #F5F7FA;
  --text-secondary: #B5C1CF;
  --text-muted: #8392A5;
  
  --accent: #69E1D1;
  --accent-hover: #52C4B5;
  --accent-glow: rgba(105, 225, 209, 0.15);
  
  --border-color: #3B4654;
  --border-subtle: #2A3542;
  --border-focus: #69E1D1;
  
  --color-success: #48BB78;
  --color-success-bg: rgba(72, 187, 120, 0.12);
  --color-warning: #ED8936;
  --color-warning-bg: rgba(237, 137, 54, 0.12);
  --color-error: #F56565;
  --color-error-bg: rgba(245, 101, 101, 0.12);
  
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.35);
  
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  
  --header-height: 70px;
  --container-max: 1200px;
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

[data-theme="light"] {
  /* Light Theme Palette */
  --bg-main: #F8FAFC;
  --bg-secondary: #EDF2F7;
  --bg-card: #FFFFFF;
  --bg-input: #F1F5F9;
  --bg-hover: #E2E8F0;
  
  --text-main: #0F172A;
  --text-secondary: #475569;
  --text-muted: #64748B;
  
  --accent: #0D9488;
  --accent-hover: #0F766E;
  --accent-glow: rgba(13, 148, 136, 0.12);
  
  --border-color: #CBD5E1;
  --border-subtle: #E2E8F0;
  --border-focus: #0D9488;
  
  --color-success: #16A34A;
  --color-success-bg: rgba(22, 163, 74, 0.1);
  --color-warning: #D97706;
  --color-warning-bg: rgba(217, 119, 6, 0.1);
  --color-error: #DC2626;
  --color-error-bg: rgba(220, 38, 38, 0.1);
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Base Reset & Core Rules */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-family);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text-main);
  background-color: var(--bg-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-main);
  color: var(--text-main);
  position: relative;
  overflow-x: hidden;
}

img, svg, picture, video {
  display: block;
  max-width: 100%;
}

input, button, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover, a:focus-visible {
  color: var(--accent-hover);
}

/* Accessibility Focus States */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Container */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

@media (min-width: 768px) {
  .container {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

/* Decorative Floating Mathematical Symbols */
.math-bg-symbols {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 520px;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
  opacity: 0.12;
}

[data-theme="light"] .math-bg-symbols {
  opacity: 0.08;
}

.math-symbol {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--accent);
  user-select: none;
  will-change: transform;
  animation: floatMath 18s ease-in-out infinite alternate;
}

.math-symbol:nth-child(1) { top: 12%; left: 8%; animation-duration: 22s; font-size: 2.4rem; }
.math-symbol:nth-child(2) { top: 25%; right: 12%; animation-duration: 26s; animation-delay: -3s; }
.math-symbol:nth-child(3) { top: 60%; left: 15%; animation-duration: 20s; animation-delay: -7s; font-size: 2.8rem; }
.math-symbol:nth-child(4) { top: 48%; right: 22%; animation-duration: 24s; animation-delay: -11s; }
.math-symbol:nth-child(5) { top: 75%; left: 45%; animation-duration: 28s; animation-delay: -5s; font-size: 2.6rem; }
.math-symbol:nth-child(6) { top: 20%; left: 55%; animation-duration: 19s; animation-delay: -8s; }
.math-symbol:nth-child(7) { top: 80%; right: 8%; animation-duration: 25s; animation-delay: -14s; font-size: 2.5rem; }

@keyframes floatMath {
  0% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-15px) rotate(6deg); }
  100% { transform: translateY(10px) rotate(-6deg); }
}

@media (prefers-reduced-motion: reduce) {
  .math-symbol {
    animation: none !important;
  }
}
