:root {
  --bg-primary: #0f0f0f;
  --bg-secondary: #22212c;
  --bg-header: #22212c;
  --border-primary: #30363d;
  --text-primary: #c9d1d9;
  --text-muted: #484f58;
  --rain-color: rgba(100, 149, 237, 0.6);
  --property: #ffa657;
  --string: #a5d6ff;
  --link: #58a6ff;
  --link-hover: #79c0ff;
  --red: #fe5f56;
  --orange: #ffbd2d;
  --green: #26c940;
}

[data-theme="light"] {
  --bg-primary: #ddefff;
  --bg-secondary: #f6f8fa;
  --bg-header: #f6f8fa;
  --border-primary: #d0d7de;
  --text-primary: #24292f;
  --text-muted: #848d97;
  --rain-color: rgba(100, 149, 237, 0.4);
  --property: #953800;
  --string: #0a3069;
  --link: #0969da;
  --link-hover: #0550ae;
  --red: #fe5f56;
  --orange: #ffbd2d;
  --green: #26c940;
}

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

html {
  font-size: 100%;
}

body {
  font-family: "Menlo", "Monaco", "Courier New", monospace;
  background: var(--bg-primary);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  color: var(--text-primary);
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
}

.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.3s ease;
  z-index: 10;
}

.theme-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.theme-icon {
  transition: transform 0.3s ease;
}

.rain-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.raindrop {
  position: absolute;
  width: 1px;
  background: var(--rain-color);
  animation: fall linear infinite;
  border-radius: 0;
}

@keyframes fall {
  from {
    transform: translateY(-100px);
    opacity: 1;
  }
  to {
    transform: translateY(calc(100vh + 100px));
    opacity: 0;
  }
}

.container {
  z-index: 2;
  position: relative;
}

.terminal {
  width: 50rem;
  max-width: 90vw;
  background: var(--bg-secondary);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  border: 1px solid var(--border-primary);
  transition:
    background-color 0.3s ease,
    border-color 0.3s ease;
}

.terminal-header {
  background: var(--bg-header);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: background-color 0.3s ease;
}

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

.terminal-title {
  margin-left: 8px;
}

.control {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  cursor: pointer;
}

.control.close {
  background: var(--red);
}

.control.minimize {
  background: var(--orange);
}

.control.maximize {
  background: var(--green);
}

.terminal-body {
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  min-height: 280px;
  transition: background-color 0.3s ease;
}

.line-number {
  display: flex;
  padding: 0 12px;
  color: var(--text-muted);
  font-size: 1rem;
  user-select: none;
  transition:
    background-color 0.3s ease,
    color 0.3s ease,
    border-color 0.3s ease;
}

.code-line {
  display: flex;
  flex-direction: row;
  padding: 0.3rem 0;
}

.property {
  color: var(--property);
  transition: color 0.3s ease;
}

.string {
  color: var(--string);
  transition: color 0.3s ease;
}

.link {
  color: var(--link);
  text-decoration: none;
  transition: color 0.3s ease;
  margin-left: 8px;
}

.link:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

.cursor {
  width: 0.5rem;
  height: 1rem;
  align-self: center;
  background: var(--text-primary);
  margin-left: 0.25rem;
  animation: blink 1s infinite;
  transition: background-color 0.3s ease;
}

@keyframes blink {
  0%,
  50% {
    opacity: 1;
  }
  51%,
  100% {
    opacity: 0;
  }
}

@media (max-width: 768px) {
  .terminal {
    max-width: 100%;
  }

  .container {
    display: flex;
    height: 90vh;
    align-self: end;
    width: 100%;
  }

  .code-content {
    padding: 0 12px;
    font-size: 0.75rem;
  }

  .line-number,
  .cursor {
    display: none;
  }

  .code-line {
    padding: 14px 16px;
    flex-wrap: wrap;
  }

  .property {
    width: 100%;
  }

  .code-line > .link:first-of-type {
    margin-left: 0;
  }

  .theme-toggle {
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rain-container {
    display: none;
  }
}
