/* === Tokyo Night Color Scheme === */
:root {
  --bg-main: #1a1b26;
  --bg-titlebar: #16161e;
  --bg-highlight: #24283b;
  --bg-input: #1f2335;
  --text-default: #a9b1d6;
  --text-bright: #c0caf5;
  --text-muted: #565f89;
  --prompt-blue: #7aa2f7;
  --green: #9ece6a;
  --cyan: #7dcfff;
  --yellow: #e0af68;
  --magenta: #bb9af7;
  --red: #f7768e;
  --orange: #ff9e64;
  --dot-red: #ff5f57;
  --dot-yellow: #febc2e;
  --dot-green: #28c840;
}

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

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  font-family: 'JetBrains Mono', monospace;
  background: #13141c;
  color: var(--text-default);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

a {
  color: var(--cyan);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--prompt-blue);
  text-decoration: underline;
}

::selection {
  background: var(--prompt-blue);
  color: var(--bg-main);
}

/* === Terminal Window === */
.terminal-window {
  background: var(--bg-main);
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* === Title Bar === */
.terminal-titlebar {
  background: var(--bg-titlebar);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--bg-highlight);
  user-select: none;
  -webkit-user-select: none;
}

.terminal-dots {
  display: flex;
  gap: 8px;
}

.terminal-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.terminal-dot.red { background: var(--dot-red); }
.terminal-dot.yellow { background: var(--dot-yellow); }
.terminal-dot.green { background: var(--dot-green); }

.terminal-title {
  color: var(--text-muted);
  font-size: 0.8rem;
  flex: 1;
  text-align: center;
  margin-right: 52px;
}

/* === Terminal Body === */
.terminal-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  padding-bottom: 80px;
  scroll-behavior: smooth;
}

.terminal-body::-webkit-scrollbar {
  width: 6px;
}

.terminal-body::-webkit-scrollbar-track {
  background: var(--bg-main);
}

.terminal-body::-webkit-scrollbar-thumb {
  background: var(--bg-highlight);
  border-radius: 3px;
}

.terminal-body::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* === Command Blocks === */
.cmd-block {
  margin-bottom: 32px;
}

.cmd-prompt {
  color: var(--text-muted);
  margin-bottom: 4px;
  font-size: 0.9rem;
  white-space: nowrap;
}

.cmd-prompt .dollar {
  color: var(--prompt-blue);
  margin-right: 6px;
}

.cmd-prompt .cmd-text {
  color: var(--text-bright);
}

.cmd-output {
  padding: 8px 0 8px 20px;
}

/* === Hero Section === */
.hero-intro {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.hero-name {
  color: var(--green);
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1.3;
}

.hero-subtitle {
  color: var(--magenta);
  font-size: 1.2rem;
  margin-top: 4px;
}

.hero-name .typing-cursor,
.hero-subtitle .typing-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--green);
  margin-left: 2px;
  animation: blink 1s step-end infinite;
  vertical-align: text-bottom;
}

.hero-subtitle .typing-cursor {
  background: var(--magenta);
}

.hero-content {
  color: var(--text-default);
  max-width: 680px;
  margin-top: 8px;
}

.hero-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.hero-links a {
  color: var(--cyan);
}

.hero-links a:hover {
  color: var(--prompt-blue);
}

/* === About Section === */
.about-content {
  color: var(--text-default);
  max-width: 700px;
}

.skills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.skill-badge {
  background: rgba(255, 158, 100, 0.12);
  color: var(--orange);
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 0.85rem;
  border: 1px solid rgba(255, 158, 100, 0.25);
}

/* === Experience Section === */
.exp-item {
  padding: 12px 0 12px 16px;
  border-left: 2px solid var(--bg-highlight);
}

.exp-item + .exp-item {
  margin-top: 8px;
}

.exp-separator {
  color: var(--text-muted);
  margin: 0;
  padding-left: 16px;
  opacity: 0.4;
}

.exp-company {
  color: var(--green);
  font-weight: 700;
  font-size: 1rem;
}

.exp-role {
  color: var(--text-bright);
  font-size: 0.95rem;
}

.exp-date {
  color: var(--yellow);
  font-size: 0.85rem;
}

.exp-desc {
  color: var(--text-default);
  margin-top: 6px;
  font-size: 0.9rem;
  white-space: pre-line;
}

/* === Education Section === */
.edu-item {
  margin-bottom: 16px;
}

.edu-title {
  color: var(--text-bright);
  font-weight: 700;
}

.edu-school {
  color: var(--cyan);
  font-size: 0.95rem;
}

.edu-date {
  color: var(--yellow);
  font-size: 0.85rem;
}

.edu-content {
  color: var(--text-default);
  font-size: 0.9rem;
  margin-top: 4px;
}

/* === Projects Section === */
.project-item {
  margin-bottom: 16px;
}

.project-title {
  color: var(--text-bright);
  font-weight: 700;
}

.project-title a {
  color: var(--text-bright);
}

.project-title a:hover {
  color: var(--cyan);
}

.project-desc {
  color: var(--text-default);
  font-size: 0.9rem;
  margin-top: 4px;
}

.project-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.project-badge {
  background: rgba(255, 158, 100, 0.12);
  color: var(--orange);
  padding: 2px 10px;
  border-radius: 3px;
  font-size: 0.8rem;
  border: 1px solid rgba(255, 158, 100, 0.25);
}

.project-links {
  margin-top: 6px;
}

.project-links a {
  color: var(--cyan);
  font-size: 0.9rem;
}

/* === Achievements Section === */
.achievement-item {
  margin-bottom: 10px;
}

.achievement-num {
  color: var(--green);
  font-weight: 700;
  margin-right: 8px;
}

.achievement-title {
  color: var(--text-bright);
  font-weight: 700;
}

.achievement-desc {
  color: var(--text-default);
  font-size: 0.9rem;
  padding-left: 28px;
}

/* === Contact Section === */
.contact-content {
  color: var(--text-default);
  max-width: 600px;
}

.contact-mail {
  margin-top: 8px;
}

.contact-mail .dollar {
  color: var(--prompt-blue);
  margin-right: 6px;
}

.contact-mail a {
  color: var(--cyan);
}

/* === Footer === */
.terminal-footer {
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--bg-highlight);
}

.footer-comment {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.footer-cursor {
  display: inline-block;
  width: 8px;
  height: 1.1em;
  background: var(--text-muted);
  animation: blink 1s step-end infinite;
  vertical-align: text-bottom;
  margin-left: 4px;
}

/* === Input Bar === */
.terminal-input-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-input);
  border-top: 1px solid var(--bg-highlight);
  padding: 12px 28px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 100;
}

.terminal-input-bar .prompt-symbol {
  color: var(--prompt-blue);
  font-weight: 700;
  flex-shrink: 0;
}

.terminal-input-bar input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-bright);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  caret-color: var(--prompt-blue);
}

.terminal-input-bar input::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

/* === Flash Message === */
.flash-message {
  position: fixed;
  bottom: 56px;
  left: 28px;
  right: 28px;
  background: rgba(247, 118, 142, 0.12);
  border: 1px solid rgba(247, 118, 142, 0.3);
  color: var(--red);
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 0.85rem;
  z-index: 101;
  animation: fadeIn 0.2s ease;
}

.flash-message.fade-out {
  animation: fadeOut 0.3s ease forwards;
}

/* === Help Overlay === */
.help-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.help-overlay.active {
  display: flex;
}

.help-panel {
  background: var(--bg-main);
  border: 1px solid var(--bg-highlight);
  border-radius: 8px;
  padding: 24px 32px;
  max-width: 520px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.help-title {
  color: var(--green);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.help-section {
  margin-bottom: 16px;
}

.help-section-title {
  color: var(--yellow);
  font-size: 0.85rem;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.help-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
}

.help-cmd {
  color: var(--cyan);
}

.help-desc {
  color: var(--text-muted);
  text-align: right;
}

.help-close-hint {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 12px;
  text-align: center;
}

/* === Section Divider === */
.section-divider {
  color: var(--text-muted);
  opacity: 0.3;
  margin: 8px 0;
}

/* === Typing Animation === */
.typing-container {
  overflow: hidden;
}

.typing-text {
  visibility: hidden;
}

.typing-text.revealed {
  visibility: visible;
}

/* === Animations === */
@keyframes blink {
  50% { opacity: 0; }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* === Desktop: Floating Window === */
@media (min-width: 960px) {
  body {
    padding: 32px;
  }

  .terminal-window {
    max-width: 900px;
    height: 85vh;
    border-radius: 10px;
    border: 1px solid var(--bg-highlight);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    overflow: hidden;
  }

  .terminal-titlebar {
    border-radius: 10px 10px 0 0;
  }

  .terminal-input-bar {
    position: absolute;
    border-radius: 0 0 10px 10px;
  }

  .flash-message {
    left: auto;
    right: auto;
    max-width: 860px;
    margin: 0 auto;
  }
}

/* === Mobile === */
@media (max-width: 959px) {
  html {
    font-size: 14px;
  }

  .terminal-body {
    padding: 16px 16px 80px;
  }

  .terminal-input-bar {
    padding: 10px 16px;
  }

  .hero-name {
    font-size: 1.4rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .help-panel {
    padding: 16px 20px;
  }

  .help-row {
    flex-direction: column;
    gap: 2px;
  }

  .help-desc {
    text-align: left;
    padding-left: 16px;
  }

  /* Disable typing animation on mobile */
  .typing-cursor {
    display: none !important;
  }

  .typing-text {
    visibility: visible !important;
  }
}

/* === Print Styles === */
@media print {
  body {
    background: white;
  }

  .terminal-window {
    background: white;
    border: none;
    box-shadow: none;
    height: auto;
    max-width: none;
  }

  .terminal-titlebar,
  .terminal-input-bar,
  .help-overlay {
    display: none !important;
  }

  .terminal-body {
    padding: 0;
    overflow: visible;
  }

  .cmd-prompt {
    color: #666;
  }

  .cmd-prompt .dollar {
    color: #333;
  }

  * {
    color: #333 !important;
    background: white !important;
    border-color: #ccc !important;
  }

  .skill-badge,
  .project-badge {
    border: 1px solid #999 !important;
  }
}
