/* ==========================================================================
   韓運字 — Design System / Global Styles
   ========================================================================== */

:root {
  /* base palette */
  --bg-deep: #0a0e1a;
  --bg-panel: #10162a;
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-bg-strong: rgba(255, 255, 255, 0.09);
  --glass-border: rgba(255, 255, 255, 0.12);

  --text-primary: #f4f2ea;
  --text-secondary: #b8bdd4;
  --text-muted: #7d84a3;

  /* 五行 colors */
  --oh-wood: #2dd4a8;   /* 木 */
  --oh-fire: #ff4757;   /* 火 */
  --oh-earth: #ffa502;  /* 土 */
  --oh-metal: #dfe6e9;  /* 金 */
  --oh-water: #3742fa;  /* 水 */

  --gold-1: #f9ca24;
  --gold-2: #f0932b;
  --gold-gradient: linear-gradient(135deg, var(--gold-1), var(--gold-2));

  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 28px;

  --shadow-glow: 0 0 24px rgba(249, 202, 36, 0.25);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.35);

  --font-jp: 'Noto Sans JP', sans-serif;
  --font-kr: 'Noto Sans KR', sans-serif;
  --font-kr-serif: 'Noto Serif KR', serif;

  --nav-w: 96px;
  --header-h: 64px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: radial-gradient(ellipse at top, #131a30 0%, var(--bg-deep) 55%, #050710 100%);
  color: var(--text-primary);
  font-family: var(--font-jp);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body { min-height: 100vh; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; }

::selection { background: var(--gold-1); color: #1a1200; }

/* scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 8px; }

/* ---------- Particle field background ---------- */
.particle-field {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

/* ---------- Header ---------- */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 50;
  background: rgba(10, 14, 26, 0.65);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--glass-border);
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-glyph { font-size: 28px; filter: drop-shadow(0 0 8px rgba(249,202,36,0.6)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-family: var(--font-kr-serif); font-size: 18px; background: var(--gold-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-text small { color: var(--text-muted); font-size: 10px; letter-spacing: 0.05em; }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.nav-toggle span { width: 22px; height: 2px; background: var(--text-primary); border-radius: 2px; }

/* ---------- Side Nav ---------- */
.main-nav {
  position: fixed;
  top: var(--header-h);
  bottom: 0;
  left: 0;
  width: var(--nav-w);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 6px;
  overflow-y: auto;
  background: rgba(16, 22, 42, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-right: 1px solid var(--glass-border);
  z-index: 40;
}

.nav-item {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 2px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.nav-icon { font-size: 20px; }
.nav-label { font-size: 9.5px; text-align: center; line-height: 1.2; }

.nav-item:hover { background: var(--glass-bg); color: var(--text-primary); transform: translateY(-1px); }
.nav-item.active {
  background: var(--glass-bg-strong);
  color: var(--gold-1);
  box-shadow: inset 0 0 0 1px rgba(249,202,36,0.35);
}

/* ---------- Main content ---------- */
.app-main {
  margin-left: var(--nav-w);
  padding: calc(var(--header-h) + 20px) 20px 60px;
  min-height: 100vh;
  position: relative;
  z-index: 1;
  max-width: 980px;
}

.view { display: none; animation: view-fade-in 0.4s ease; }
.view.active { display: block; }

.app-footer {
  margin-left: var(--nav-w);
  padding: 16px 20px 30px;
  color: var(--text-muted);
  font-size: 11px;
  position: relative;
  z-index: 1;
}

/* ---------- Hero (home) ---------- */
.hero { padding: 32px 24px; margin-bottom: 24px; }
.hero-title { font-family: var(--font-kr-serif); font-size: clamp(22px, 4vw, 32px); margin: 0 0 10px; line-height: 1.4; }
.hero-title .accent { background: var(--gold-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub { color: var(--text-secondary); margin: 0 0 20px; font-size: 14px; }
.hero-user { display: flex; gap: 10px; padding: 14px; flex-wrap: wrap; }
.hero-user input {
  flex: 1;
  min-width: 180px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text-primary);
  font-size: 14px;
}
.hero-user input:focus { outline: none; border-color: var(--gold-1); }

.home-dashboard { margin-bottom: 20px; }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}

/* ---------- Section heading helper ---------- */
.section-head { margin-bottom: 18px; }
.section-head h2 { font-family: var(--font-kr-serif); font-size: 24px; margin: 0 0 6px; }
.section-head p { color: var(--text-secondary); font-size: 13px; margin: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .main-nav {
    top: var(--header-h);
    left: 0; right: 0; bottom: auto;
    width: 100%;
    height: 0;
    overflow: hidden;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    padding: 0;
    border-right: none;
    border-bottom: 1px solid var(--glass-border);
    transition: height 0.25s ease, padding 0.25s ease;
  }
  .main-nav.open { height: auto; max-height: 70vh; padding: 10px 6px; overflow-y: auto; }
  .nav-item { width: 30%; }
  .nav-toggle { display: flex; }
  .app-main, .app-footer { margin-left: 0; }
  .app-main { padding: calc(var(--header-h) + 14px) 14px 50px; }
}

@media (prefers-color-scheme: light) {
  /* Service is intentionally dark-mode-first (night-sky / mystical theme);
     keep same palette to preserve the neon-glow aesthetic regardless of OS theme. */
}
