* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #24292f;
  min-height: 100vh;
}

#page {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px 48px;
}

/* ── Header ── */
#page-header {
  text-align: center;
  margin-bottom: 32px;
  position: relative;
}

#lang-toggle {
  position: absolute;
  top: 0;
  right: 0;
  background: #f6f8fa;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #24292f;
  cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  transition: background 0.15s;
}

#lang-toggle:hover {
  background: #eaeef2;
}

#page-header h1 {
  font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
  font-size: 28px;
  color: #24292f;
  letter-spacing: 2px;
}

#page-header p {
  color: #57606a;
  font-size: 14px;
  margin-top: 6px;
}

#title-link {
  text-decoration: none;
  color: inherit;
}

#title-link:hover h1 {
  opacity: 0.7;
}

.made-by {
  font-size: 12px !important;
  color: #8c959f !important;
  margin-top: 4px !important;
}

.made-by a {
  color: #0969da;
  text-decoration: none;
}

.made-by a:hover {
  text-decoration: underline;
}

/* ── Terminal ── */
#terminal {
  width: 100%;
  height: 55vh;
  min-height: 320px;
  background: #0d1117;
  border-radius: 12px;
  overflow: hidden;
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
}

#terminal-header {
  background: #161b22;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #30363d;
  user-select: none;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.dot.red { background: #ff5f57; }
.dot.yellow { background: #febc2e; }
.dot.green { background: #28c840; }

#terminal-title {
  color: #8b949e;
  font-size: 13px;
  margin-left: 8px;
  font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
}

#terminal-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  color: #e6edf3;
  font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.6;
  cursor: text;
  outline: none;
}

#terminal-body::-webkit-scrollbar {
  width: 8px;
}
#terminal-body::-webkit-scrollbar-track {
  background: transparent;
}
#terminal-body::-webkit-scrollbar-thumb {
  background: #30363d;
  border-radius: 4px;
}

#output .line {
  white-space: pre-wrap;
  word-break: break-all;
}

#input-line {
  display: flex;
  align-items: center;
}

#prompt {
  color: #7ee787;
  white-space: pre;
  flex-shrink: 0;
}

#input-wrapper {
  display: inline;
}

#input-left, #input-right {
  white-space: pre;
}

#cursor {
  background: #e6edf3;
  color: #0d1117;
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  50% { background: transparent; color: #e6edf3; }
}

/* ── Guide Section ── */
#guide {
  margin-top: 32px;
}

#guide h2 {
  font-size: 18px;
  color: #24292f;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid #d0d7de;
}

#guide-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.guide-card {
  background: #f6f8fa;
  border: 1px solid #d0d7de;
  border-radius: 8px;
  padding: 16px 20px;
}

.guide-card h3 {
  font-size: 14px;
  color: #0969da;
  margin-bottom: 10px;
  font-weight: 600;
}

.guide-card ul {
  list-style: none;
}

.guide-card li {
  font-size: 13px;
  color: #57606a;
  padding: 3px 0;
  line-height: 1.5;
}

.guide-card code {
  font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
  color: #24292f;
  background: rgba(175, 184, 193, 0.2);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
}

.guide-card kbd {
  font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
  font-size: 11px;
  color: #24292f;
  background: #f6f8fa;
  border: 1px solid #d0d7de;
  border-radius: 4px;
  padding: 1px 6px;
  box-shadow: 0 1px 0 #d0d7de;
}

/* ── Footer ── */
#page-footer {
  text-align: center;
  margin-top: 32px;
  color: #8c959f;
  font-size: 13px;
}

#page-footer code {
  font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
  color: #57606a;
}

/* ── Hidden Input ── */
#hidden-input {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 1px;
  opacity: 0.01;
  border: none;
  outline: none;
  background: transparent;
  color: transparent;
  font-size: 16px;
  z-index: -1;
}

/* ── Color classes ── */
.color-green { color: #7ee787; }
.color-blue { color: #79c0ff; }
.color-yellow { color: #e3b341; }
.color-red { color: #ff7b72; }
.color-cyan { color: #a5d6ff; }
.color-magenta { color: #d2a8ff; }
.color-gray { color: #8b949e; }
.color-white { color: #e6edf3; }
.bold { font-weight: bold; }

.dir-entry { color: #79c0ff; font-weight: bold; }
.file-entry { color: #e6edf3; }
.exec-entry { color: #7ee787; }

/* ── Tooltips ── */
.tip {
  cursor: pointer;
  position: relative;
}

.tip-bubble {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #f6f8fa;
  color: #24292f;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 12px;
  font-weight: normal;
  line-height: 1.5;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #d0d7de;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  white-space: normal;
  word-break: keep-all;
  width: max-content;
  max-width: 260px;
  z-index: 100;
  pointer-events: none;
  animation: tipFadeIn 0.15s ease;
}

.tip-bubble::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #f6f8fa;
}

.tip-bubble::before {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 7px solid transparent;
  border-top-color: #d0d7de;
}

@keyframes tipFadeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(4px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Vi Editor ── */
.vi-cursor {
  background: #e6edf3;
  color: #0d1117;
}

.vi-cmd-cursor {
  background: #e6edf3;
  color: #0d1117;
}

.vi-status-bar {
  background: #e6edf3;
  color: #0d1117;
  padding: 0 4px;
  display: flex;
  justify-content: space-between;
  font-weight: bold;
  margin: 0 -16px;
  padding: 0 16px;
}

.vi-status-insert {
  color: #0d1117;
  font-weight: bold;
}

/* ── Mobile ── */
@media (max-width: 600px) {
  #page {
    padding: 16px 12px 32px;
  }

  #page-header {
    margin-bottom: 20px;
  }

  #page-header h1 {
    font-size: 22px;
  }

  #terminal {
    height: 50vh;
    min-height: 280px;
    border-radius: 8px;
  }

  #terminal-body {
    font-size: 12px;
    padding: 10px;
  }

  #guide-grid {
    grid-template-columns: 1fr;
  }

  .guide-card {
    padding: 12px 16px;
  }

  .tip-bubble {
    max-width: 200px;
    font-size: 11px;
  }
}
