@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700&family=JetBrains+Mono:wght@400;500&family=Space+Grotesk:wght@500;700&display=swap");

:root {
  /* Developer Friendly Palette (Inspired by Nord/Slate) */
  --bg-dark: #0f172a; /* Slate 900 */
  --bg-light: #1e293b; /* Slate 800 */
  
  --bg-gradient: radial-gradient(circle at top center, #1e293b 0%, #0f172a 80%);
  
  --panel-bg: rgba(30, 41, 59, 0.95); /* High opacity for readability */
  --panel-border: rgba(148, 163, 184, 0.1);
  
  --accent-primary: #38bdf8; /* Sky 400 - Soothing Blue */
  --accent-secondary: #818cf8; /* Indigo 400 - Soft Purple */
  
  --text-main: #e2e8f0; /* Slate 200 - Soft White */
  --text-muted: #94a3b8; /* Slate 400 - Readable Gray */
  
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.5);
  --glass-blur: blur(12px);
  
  --memo-bg: #020617; /* Slate 950 - Deep dark for focus */
  --memo-text: #cbd5e1; /* Slate 300 - Softer than pure white */
}

/* Base Reset & Typography */
* {
  box-sizing: border-box;
}

body {
  font-family: "Noto Sans KR", "Pretendard", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  margin: 0;
  padding: 0;
  line-height: 1.6;
}

/* Background Effects (Subtle) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: 
    radial-gradient(circle at 15% 20%, rgba(56, 189, 248, 0.08), transparent 40%),
    radial-gradient(circle at 85% 10%, rgba(129, 140, 248, 0.08), transparent 40%);
  z-index: -2;
  pointer-events: none;
}

/* Layout */
main.container {
  padding-top: 5.5rem; /* Adjusted for fixed navbar + small gap */
  padding-bottom: 4rem;
  max-width: 1200px;
}

#content {
  background: transparent;
  border: none;
  padding: 0;
}

/* Navbar Overrides */
.navbar {
  background: rgba(15, 23, 42, 0.95) !important;
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--panel-border);
}

.navbar .navbar-brand {
  font-weight: 700;
  color: var(--text-main);
}

.navbar .form-control {
  border-radius: 8px;
  background: var(--bg-light);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
}

.navbar .form-control:focus {
  background: var(--bg-light);
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
  color: var(--text-main);
}

/* Quote Section - Fixed Visibility & Alignment */
.quote-card {
  margin: 0 auto 1.5rem; /* Reduced from 2rem */
  max-width: 800px;
  text-align: center;
  padding: 1.2rem 1.5rem; /* Reduced from 1.8rem 1.5rem */
  border-radius: 16px;
  background: rgba(30, 41, 59, 0.6); /* Semi-transparent Slate 800 */
  border: 1px solid rgba(148, 163, 184, 0.15);
  backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.quote-text {
  font-family: "Noto Sans KR", serif;
  font-size: 1.35rem; /* Increased size */
  font-weight: 500;
  color: #f8fafc; /* Brightest white for text */
  line-height: 1.6;
  margin-bottom: 0.8rem;
  word-break: keep-all;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3); /* Shadow for readability */
}

.quote-subtext {
  font-family: "JetBrains Mono", monospace; /* Developer friendly font */
  font-size: 0.95rem;
  color: #cbd5e1; /* Lighter gray */
  margin-bottom: 1rem;
  font-style: normal;
}

.quote-author {
  font-size: 0.95rem;
  color: var(--accent-primary);
  font-weight: 600;
  margin-top: 0.5rem;
  padding: 0.4rem 1rem;
  background: rgba(56, 189, 248, 0.1);
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.2);
}

/* Cards & Panels */
.memo-shell,
.calc-card {
  border-radius: 16px;
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  box-shadow: var(--shadow-lg);
  padding: 24px;
}

/* Memo Section - Eye Comfort Focus */
.memo-shell {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.memo-shell h2 {
  font-family: "Noto Sans KR", sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--text-main);
  margin-bottom: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.memo-shell h2::before {
  content: "";
  display: block;
  width: 4px;
  height: 24px;
  background: var(--accent-primary);
  border-radius: 2px;
}

.memo-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.memo-title-row {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.memo-title-actions {
  display: flex;
  gap: 8px;
}

.memo-subtext {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.memo-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Buttons - Subtle & Clean */
.btn_save,
.btn-calc-jump {
  border-radius: 8px;
  padding: 8px 16px;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
}

.btn_save {
  background: var(--accent-primary);
  color: #0f172a; /* Dark text on bright button */
}

.btn_save:hover {
  background: #7dd3fc; /* Lighter Sky */
  transform: translateY(-1px);
}

.btn-calc-jump {
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--text-muted);
}

.btn-calc-jump:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--panel-border);
  font-family: "JetBrains Mono", monospace;
}

.stat-chip strong {
  color: var(--accent-secondary);
}

/* Textarea - Optimized for Coding/Writing */
.tarea {
  width: 100%;
  min-height: 600px;
  background: var(--memo-bg);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 24px;
  color: var(--memo-text);
  font-size: 1.05rem; /* Comfortable size */
  line-height: 1.8; /* Relaxed line height */
  resize: vertical;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
  caret-color: var(--accent-primary);
  font-family: "JetBrains Mono", "Pretendard", monospace; /* Developer font */
  transition: border-color 0.2s ease;
}

.tarea:focus {
  border-color: var(--accent-primary);
  outline: none;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3), 0 0 0 1px var(--accent-primary);
}

.tarea::placeholder {
  color: rgba(148, 163, 184, 0.3);
}

/* Calculator Card */
.calc-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 100%;
}

.calc-pill {
  align-self: flex-start;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 700;
  background: rgba(56, 189, 248, 0.1);
  color: var(--accent-primary);
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.calc-display {
  background: #020617;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid var(--panel-border);
  text-align: right;
}

.calc-display input {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 2rem;
  font-family: "JetBrains Mono", monospace;
  text-align: right;
  margin-bottom: 4px;
}

.calc-display input:focus {
  outline: none;
}

#calc-preview {
  font-size: 1rem;
  color: var(--text-muted);
  min-height: 1.5rem;
  font-family: "JetBrains Mono", monospace;
}

.calc-input-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#calc-expression {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  background: var(--bg-light);
  padding: 12px 16px;
  color: var(--text-main);
  font-size: 1rem;
  font-family: "JetBrains Mono", monospace;
}

#calc-expression:focus {
  border-color: var(--accent-primary);
  outline: none;
}

.key-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

kbd {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-dark);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
}

.calc-pad {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.calc-pad button {
  border: none;
  border-radius: 8px;
  padding: 16px 0;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-main);
  background: var(--bg-light);
  border: 1px solid var(--panel-border);
  transition: all 0.1s ease;
  cursor: pointer;
  font-family: "JetBrains Mono", sans-serif;
}

.calc-pad button:hover {
  background: #334155; /* Slate 700 */
  transform: translateY(-1px);
}

.calc-pad button:active {
  transform: translateY(0);
}

.calc-pad button.operator {
  color: var(--accent-primary);
  background: rgba(56, 189, 248, 0.05);
}

.calc-pad button.operator:hover {
  background: rgba(56, 189, 248, 0.15);
}

.calc-pad button.utility {
  color: #fbbf24; /* Amber 400 */
}

.calc-pad button.equal {
  background: var(--accent-primary);
  color: #0f172a;
  font-weight: 700;
  border: none;
}

.calc-pad button.equal:hover {
  background: #7dd3fc;
}

#calc-result {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

footer.footer {
  background: transparent;
  border-top: 1px solid var(--panel-border);
  padding-top: 24px;
  padding-bottom: 40px; /* Added space at the bottom */
  margin-top: 40px;
  text-align: center;
}

/* Responsive */
@media (max-width: 991px) {
  main.container {
    padding-top: 5rem;
  }
  .memo-shell, .calc-card {
    padding: 20px;
  }
}

@media (max-width: 576px) {
  main.container {
    padding-top: 4.5rem;
  }
  .memo-title-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .memo-title-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .calc-pad {
    gap: 6px;
  }
  .calc-pad button {
    padding: 12px 0;
    font-size: 1rem;
  }
  .quote-card {
    padding: 0.8rem 0.8rem; /* Reduced from 1.2rem 1rem */
    margin-bottom: 1rem; /* Reduced from 1.5rem */
  }
  .quote-text {
    font-size: 1rem; /* Slightly smaller for mobile */
    margin-bottom: 0.3rem;
  }
}