:root {
  --bg-light: #f0f0f0;
  --text-light: #000000;
  --border-light: #c0c0c0;
  --accent-light: #00cc66;
  --window-bg-light: #ffffff;
  --shadow-light: rgba(0, 0, 0, 0.2);

  --bg-dark: #1a1a1a;
  --text-dark: #00ff00;
  --border-dark: #333333;
  --accent-dark: #00cc66;
  --window-bg-dark: #2d2d2d;
  --shadow-dark: rgba(0, 0, 0, 0.5);
  --logo-glow-dark: rgba(0, 255, 0, 0.5);
}

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

body {
  font-family:
    ui-monospace, "SF Mono", "Monaco", "Cascadia Code",
    "Segoe UI Mono", "Roboto Mono", "Ubuntu Mono", "Menlo", "Consolas",
    "Liberation Mono", "DejaVu Sans Mono", "Courier New", monospace;
  background: var(--bg-light);
  color: var(--text-light);
  transition: all 0.3s ease;
  overflow: hidden;
  height: 100vh;
}

body.dark-mode {
  background: var(--bg-dark);
  color: var(--text-dark);
}

body.light-mode {
  background: var(--bg-light);
  color: var(--text-light);
}

/* Main Container */
.main-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  transition: all 0.5s ease;
  background: radial-gradient(circle at 25% 25%, rgba(0, 255, 0, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 75% 75%, rgba(0, 204, 102, 0.1) 0%, transparent 50%);
}

.main-container.blurred {
  filter: blur(3px) brightness(0.7);
  transform: scale(0.95);
}

/* Terminal-style grid background */
.main-container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: linear-gradient(rgba(0, 255, 0, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 0, 0.05) 1px, transparent 1px);
  background-size: 20px 20px;
  opacity: 0.3;
  pointer-events: none;
}

/* Logo Container */
.logo-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 3rem;
  z-index: 2;
}

.logo-wrapper {
  position: relative;
  cursor: pointer;
  width: clamp(120px, 20vw, 200px);
  height: clamp(120px, 20vw, 200px);
  transition: transform 0.3s ease;
}

/* 3D Sphere effect */
.logo-sphere {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.3), transparent 70%);
  box-shadow: 0 10px 30px var(--shadow-light), inset 0 -5px 15px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.dark-mode .logo-sphere {
  box-shadow: 0 10px 30px var(--shadow-dark), inset 0 -5px 15px rgba(0, 0, 0, 0.3);
}

/* Logo Image */
.logo-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  transition: all 0.3s ease;
}

/* Projection Light on Hover */
.logo-wrapper::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 1;
}

/* Shadow beneath logo */
.logo-wrapper::after {
  content: "";
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  height: 10px;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.3) 0%, transparent 70%);
  opacity: 0;
  transition: all 0.3s ease;
  filter: blur(5px);
}

.dark-mode .logo-wrapper::after {
  background: radial-gradient(ellipse, rgba(0, 255, 0, 0.2) 0%, transparent 70%);
}

/* Hover Effects */
.logo-wrapper:hover {
  transform: translateY(-5px);
}

.logo-wrapper:hover::before {
  opacity: 1;
}

.logo-wrapper:hover::after {
  opacity: 1;
  width: 90%;
}

.logo-wrapper:hover .logo-sphere {
  box-shadow: 0 15px 40px var(--shadow-light), 0 0 30px rgba(0, 0, 0, 0), inset 0 -5px 15px
    rgba(0, 0, 0, 0.1);
}

.dark-mode .logo-wrapper:hover .logo-sphere {
  box-shadow: 0 15px 40px var(--shadow-dark), 0 0 30px var(--logo-glow-dark), inset 0 -5px 15px
    rgba(0, 0, 0, 0.3);
}

/* Theme Indicator */
.theme-indicator {
  font-size: clamp(0.8rem, 2vw, 1rem);
  color: var(--text-light);
  opacity: 0.7;
  text-transform: lowercase;
  font-family: inherit;
  letter-spacing: 2px;
  transition: opacity 0.3s ease;
}

.dark-mode .theme-indicator {
  color: var(--text-dark);
}

.theme-indicator::before {
  content: "[ ";
}

.theme-indicator::after {
  content: " ]";
}

/* Active state animation */
.logo-wrapper:active {
  transform: translateY(-3px) scale(0.95);
}

.logo-wrapper:active .logo-sphere {
  box-shadow: 0 8px 20px var(--shadow-light), inset 0 -3px 10px rgba(0, 0, 0, 0.2);
}

/* Main Title */
.main-title {
  font-size: clamp(2rem, 8vw, 6rem);
  font-weight: 700;
  text-align: center;
  margin-bottom: 3rem;
  position: relative;
  z-index: 2;
}

.title-word {
  position: relative;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-block;
}

.title-word::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 0;
  height: 2px;
  background: currentColor;
  transition: width 0.3s ease;
}

.title-word:hover::after {
  width: 100%;
}

.david-word:hover {
  color: var(--text-light);
}

.draphy-word:hover {
  color: var(--text-dark);
}

/* Navigation */
.nav-container {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  justify-content: center;
  z-index: 2;
  position: relative;
}

.nav-item {
  background: var(--window-bg-light);
  border: 2px solid var(--border-light);
  padding: 1rem 2rem;
  cursor: pointer;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: 2px 2px 4px var(--shadow-light);
  white-space: nowrap;
  text-overflow: ellipsis;
  min-width: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.nav-item::before {
  content: "> ";
  opacity: 0;
  margin-right: 0;
  transition: all 0.3s ease;
}

.nav-item:hover::before {
  opacity: 1;
  margin-right: 0.5rem;
}

.nav-item:hover {
  transform: translateY(-2px);
  box-shadow: 4px 4px 8px var(--shadow-light);
}

.dark-mode .nav-item {
  background: var(--window-bg-dark);
  border-color: var(--border-dark);
  color: var(--text-dark);
  box-shadow: 2px 2px 4px var(--shadow-dark);
}

.dark-mode .nav-item:hover {
  box-shadow: 4px 4px 8px var(--shadow-dark);
}

/* Chat Popup */
.chat-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  width: 80vw;
  max-width: 700px;
  background: var(--window-bg-light);
  border: 3px solid var(--border-light);
  box-shadow: 5px 5px 15px var(--shadow-light);
  z-index: 4000;
  transition: all 0.3s ease;
  opacity: 0;
}

.chat-popup.active {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.dark-mode .chat-popup {
  background: var(--window-bg-dark);
  border-color: var(--border-dark);
  color: var(--text-dark);
  box-shadow: 5px 5px 15px var(--shadow-dark);
}

/* Title Bar */
.title-bar {
  background: linear-gradient(to right, var(--accent-light), #009955);
  color: white;
  padding: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
}

.dark-mode .title-bar {
  background: linear-gradient(to right, var(--accent-dark), #009955);
}

.title-bar-controls {
  display: flex;
  gap: 0.3rem;
}

.control-btn {
  width: 18px;
  height: 18px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.2);
  cursor: pointer;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.control-btn:hover {
  background: rgba(255, 255, 255, 0.4);
}

.close-btn::before {
  content: "×";
  color: white;
  font-weight: bold;
}

/* Window Body */
.window-body {
  padding: 1rem;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding-bottom: 1rem;
}

.chat-box {
  height: 450px;
  overflow-y: auto;
  background: var(--bg-light);
  border: 2px inset var(--border-light);
  margin-bottom: 1rem;
  padding: 0.5rem;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.4;
  scrollbar-width: thin;
  scrollbar-color: var(--border-light) var(--bg-light);
}

.chat-box::-webkit-scrollbar {
  width: 12px;
}

.chat-box::-webkit-scrollbar-track {
  background: var(--bg-light);
  border: 1px solid var(--border-light);
}

.chat-box::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border: 1px solid var(--border-light);
}

.chat-box::-webkit-scrollbar-thumb:hover {
  background: var(--accent-light);
}

.dark-mode .chat-box::-webkit-scrollbar-track {
  background: var(--bg-dark);
  border-color: var(--border-dark);
}

.dark-mode .chat-box::-webkit-scrollbar-thumb {
  background: var(--border-dark);
  border-color: var(--accent-dark);
}

.dark-mode .chat-box::-webkit-scrollbar-thumb:hover {
  background: var(--accent-dark);
}

.dark-mode .chat-box {
  background: var(--bg-dark);
  border-color: var(--border-dark);
  color: var(--text-dark);
  scrollbar-color: var(--border-dark) var(--bg-dark);
}

.message {
  margin: 0.5rem 0;
  padding: 0.25rem;
}

.message.user {
  font-weight: bold;
  color: var(--accent-light);
}

.message.user::before {
  content: "$ ";
}

.message.assistant {
  color: var(--text-light);
  margin-left: 1rem;
}

.message.assistant::before {
  content: ">> ";
  color: var(--accent-light);
}

.dark-mode .message.user {
  color: var(--accent-dark);
}

.dark-mode .message.assistant {
  color: var(--text-dark);
}

.dark-mode .message.assistant::before {
  color: var(--accent-dark);
}

/* Typewriter cursor animation */
@keyframes blink {
  0%,
  50% {
    opacity: 1;
  }

  51%,
  100% {
    opacity: 0;
  }
}

/* Form Elements */
.field-row {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
  gap: 0.5rem;
}

.field-row-stacked {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

input[type="text"] {
  flex: 1;
  padding: 0.5rem;
  border: 2px inset var(--border-light);
  background: var(--window-bg-light);
  font-family: inherit;
  font-size: 0.9rem;
}

.dark-mode input[type="text"] {
  background: var(--window-bg-dark);
  border-color: var(--border-dark);
  color: var(--text-dark);
}

button {
  padding: 0.5rem 1rem;
  border: 2px outset var(--border-light);
  background: var(--window-bg-light);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  transition: all 0.1s ease;
}

button:active {
  border-style: inset;
}

.dark-mode button {
  background: var(--window-bg-dark);
  border-color: var(--border-dark);
  color: var(--text-dark);
}

/* Progress Bar */
.progress-bar-container {
  width: 100%;
  height: 20px;
  border: 2px inset var(--border-light);
  background: var(--bg-light);
  margin-top: 0.5rem;
  position: relative;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent-light), #00ff88);
  transition: width 0.2s ease;
  animation: progressPulse 1s ease-in-out infinite alternate;
}

@keyframes progressPulse {
  from {
    opacity: 0.8;
  }

  to {
    opacity: 1;
  }
}

.dark-mode .progress-bar-container {
  border-color: var(--border-dark);
  background: var(--bg-dark);
}

.dark-mode .progress-bar {
  background: linear-gradient(90deg, var(--accent-dark), #00ff88);
}

/* Transition Overlays */
.transition-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg-light);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  padding: 1rem;
}

.transition-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.dark-mode .transition-overlay {
  background: var(--bg-dark);
}

.transition-text {
  font-size: clamp(1.2rem, 4vw, 2rem);
  color: var(--text-light);
  animation: blink 1s infinite;
  text-align: center;
  word-break: break-word;
  max-width: 90%;
}

.dark-mode .transition-text {
  color: var(--text-dark);
}

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

  51%,
  100% {
    opacity: 0.3;
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .logo-wrapper {
    width: clamp(100px, 25vw, 150px);
    height: clamp(100px, 25vw, 150px);
  }

  .logo-container {
    gap: 1rem;
    margin-bottom: 2rem;
  }
  .chat-toggle {
    width: 50px;
    height: 50px;
    bottom: 1.5rem;
    right: 1.5rem;
  }
  .main-title {
    font-size: 3rem;
    margin-bottom: 2rem;
  }

  .nav-container {
    flex-direction: column;
    align-items: center;
    gap: 1rem;
  }

  .nav-item {
    width: 200px;
    text-align: center;
    padding: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .chat-popup {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    top: 0;
    left: 0;
    transform: translate(0, 0) scale(0);
    border-radius: 0;
    border: none;
  }

  .window-body {
    max-height: calc(100vh - 120px);
    padding: 0.75rem;
    padding-bottom: 90px;
  }

  .chat-popup.active {
    transform: translate(0, 0) scale(1);
  }

  .chat-box {
    flex: 1;
    min-height: 300px;
    height: auto;
  }

  .field-row-stacked {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .logo-wrapper {
    width: clamp(80px, 30vw, 120px);
    height: clamp(80px, 30vw, 120px);
  }

  .chat-popup {
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }

  .window-body {
    max-height: calc(100vh - 100px);
    padding: 0.5rem;
    padding-bottom: 85px;
  }

  .chat-box {
    flex: 1;
    min-height: 250px;
    height: auto;
  }
  .chat-toggle {
    width: 50px;
    height: 50px;
    bottom: 1.2rem;
    right: 1.2rem;
  }

  .chat-toggle::after {
    bottom: -12px;
    height: 6px;
  }
  .main-title {
    font-size: 2rem;
  }

  .nav-item {
    width: 180px;
    font-size: 0.9rem;
    padding: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .theme-indicator {
    font-size: 0.75rem;
  }
}

@media (max-width: 480px) {
  .iframe-header {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    gap: 0.4rem;
  }

  .iframe-header-controls {
    gap: 0.4rem;
  }

  .share-button {
    padding: 0.2rem 0.4rem;
    font-size: 0.6rem;
    gap: 0.2rem;
    min-width: auto;
  }

  .share-button span {
    display: none;
  }

  .exit-button {
    padding: 0.2rem 0.5rem;
    font-size: 0.65rem;
  }
}

/* Loading Animation */
.loading {
  width: 16px;
  height: 16px;
  border: 2px solid var(--text-light);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 10px auto;
}

.dark-mode .loading {
  border-color: var(--text-dark);
  border-top-color: transparent;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* Chat Toggle Button */
.chat-toggle {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: transform 0.3s ease;
  z-index: 3000;
  padding: 0;
}

.chat-toggle .logo-sphere {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--bg-light);
  box-shadow: 0 10px 30px var(--shadow-light), inset 0 -5px 15px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.dark-mode .chat-toggle .logo-sphere {
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.3), transparent 70%);
  box-shadow: 0 10px 30px var(--shadow-dark), inset 0 -5px 15px rgba(0, 0, 0, 0.3);
}

.chat-toggle .logo-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.chat-toggle::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 1;
}

.chat-toggle::after {
  content: "";
  position: absolute;
  bottom: -15px;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  height: 8px;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.3) 0%, transparent 70%);
  opacity: 0;
  transition: all 0.3s ease;
  filter: blur(4px);
}

.dark-mode .chat-toggle::after {
  background: radial-gradient(ellipse, rgba(0, 255, 0, 0.2) 0%, transparent 70%);
}

.chat-toggle:hover {
  transform: translateY(-5px);
}

.chat-toggle:hover::before {
  opacity: 1;
}

.chat-toggle:hover::after {
  opacity: 1;
  width: 90%;
}

.chat-toggle:hover .logo-sphere {
  box-shadow: 0 15px 40px var(--shadow-light), 0 0 30px rgba(0, 0, 0, 0), inset 0 -5px 15px
    rgba(0, 0, 0, 0.1);
}

.dark-mode .chat-toggle:hover .logo-sphere {
  box-shadow: 0 15px 40px var(--shadow-dark), 0 0 30px var(--logo-glow-dark), inset 0 -5px 15px
    rgba(0, 0, 0, 0.3);
}

.chat-toggle:active {
  transform: translateY(-3px) scale(0.95);
}

/* Iframe Container */
.iframe-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg-light);
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  display: flex;
  flex-direction: column;
}

.iframe-container.active {
  opacity: 1;
  pointer-events: all;
}

.dark-mode .iframe-container {
  background: var(--bg-dark);
}

/* Iframe Terminal Header */
.iframe-header {
  background: linear-gradient(to right, var(--accent-light), #009955);
  color: white;
  padding: 0.5rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 0.9rem;
  gap: 1rem;
}

.dark-mode .iframe-header {
  background: linear-gradient(to right, var(--accent-dark), #009955);
}

.iframe-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.iframe-title::before {
  content: ">";
  font-weight: bold;
}

/* Header Controls Container */
.iframe-header-controls {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

/* Share Button */
.share-button {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.75rem;
  transition: all 0.2s ease;
  backdrop-filter: blur(5px);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 2px;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: fit-content;
  white-space: nowrap;
}

.share-button:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.share-button:active {
  transform: translateY(0);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

.share-button::before {
  content: "WGET ";
  font-size: 0.7rem;
  opacity: 0.8;
}

.share-button:focus {
  outline: 1px solid rgba(255, 255, 255, 0.8);
  outline-offset: 2px;
}

/* Share Button Copied State */
.share-button.copied {
  background: rgba(0, 255, 0, 0.2);
  border-color: rgba(0, 255, 0, 0.4);
  color: #00ff00;
}

.share-button.copied::before {
  content: "COPIED ";
  color: #00ff00;
}

.dark-mode .share-button.copied,
.dark-mode .share-button.copied::before {
  color: var(--text-dark);
}

/* Exit Button */
.exit-button {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 0.3rem 0.8rem;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
  transition: all 0.2s ease;
  backdrop-filter: blur(5px);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.exit-button:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-1px);
}

.exit-button::before {
  content: "ESC ";
  font-size: 0.7rem;
  opacity: 0.8;
}

/* Main Iframe */
.main-iframe {
  flex: 1;
  border: none;
  width: 100%;
  background: var(--window-bg-light);
}

.dark-mode .main-iframe {
  background: var(--window-bg-dark);
}

/* Loading States */
.iframe-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: var(--text-light);
  z-index: 10;
}

.dark-mode .iframe-loading {
  color: var(--text-dark);
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-light);
  border-top: 3px solid var(--accent-light);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

.dark-mode .loading-spinner {
  border-color: var(--border-dark);
  border-top-color: var(--accent-dark);
}

.loading-text {
  font-family: inherit;
  font-size: 1rem;
  animation: blink 1.5s infinite;
}

/* Hidden states */
.hidden {
  display: none !important;
}

/* Mobile responsiveness for iframe */
@media (max-width: 768px) {
  .iframe-header {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    gap: 0.6rem;
  }

  .iframe-header-controls {
    gap: 0.5rem;
  }

  .share-button {
    padding: 0.25rem 0.5rem;
    font-size: 0.65rem;
    gap: 0.3rem;
  }

  .share-button::before {
    font-size: 0.6rem;
    opacity: 0.8;
  }

  .exit-button {
    padding: 0.2rem 0.6rem;
    font-size: 0.7rem;
  }
}

button.nav-item {
  border: 2px solid var(--border-light);
  background: var(--window-bg-light);
  color: var(--text-light);
  font-family: inherit;
  text-align: center;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

button.nav-item:focus {
  outline: 2px solid var(--accent-light);
  outline-offset: 2px;
}

.dark-mode button.nav-item {
  background: var(--window-bg-dark);
  border-color: var(--border-dark);
  color: var(--text-dark);
}

.dark-mode button.nav-item:focus {
  outline-color: var(--accent-dark);
}

button.logo-wrapper {
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  box-shadow: none;
  appearance: none;
  -webkit-appearance: none;
  color: inherit;
  font: inherit;
  line-height: normal;
  display: inline-block;
  cursor: pointer;
}
button.logo-wrapper:focus {
  outline: none;
}
button.logo-wrapper:focus-visible {
  outline: 2px solid var(--accent-light);
  outline-offset: 4px;
}

button.control-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  font-family: inherit;
  padding: 0;
  margin: 0;
}

button.control-btn:focus {
  outline: 1px solid rgba(255, 255, 255, 0.8);
  outline-offset: 1px;
}

/* Disclaimer */
.disclaimer {
  background: rgba(255, 200, 0, 0.1);
  border: 1px solid rgba(255, 200, 0, 0.3);
  border-left: 3px solid rgba(255, 200, 0, 0.8);
  padding: 0.5rem;
  margin-bottom: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: clamp(0.65rem, 2vw, 0.75rem);
  transition: all 0.3s ease;
  max-height: 100px;
  overflow: hidden;
  flex-shrink: 0;
}

.disclaimer.collapsed {
  max-height: 0;
  padding: 0;
  margin-bottom: 0;
  border-width: 0;
  opacity: 0;
}

.dark-mode .disclaimer {
  background: rgba(255, 200, 0, 0.05);
  border-color: rgba(255, 200, 0, 0.2);
  border-left-color: rgba(255, 200, 0, 0.6);
}

.disclaimer-content {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.disclaimer-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.disclaimer-text {
  line-height: 1.3;
  color: var(--text-light);
  word-wrap: break-word;
  overflow-wrap: break-word;
  flex: 1;
  min-width: 0;
}

.disclaimer-link {
  color: var(--accent-light);
  text-decoration: underline;
  transition: opacity 0.2s ease;
}

.disclaimer-link:hover {
  opacity: 0.8;
}

.dark-mode .disclaimer-link {
  color: var(--accent-dark);
}

.dark-mode .disclaimer-text {
  color: var(--text-dark);
}

.disclaimer-toggle {
  background: transparent;
  border: 1px solid rgba(255, 200, 0, 0.4);
  padding: 0.2rem 0.4rem;
  cursor: pointer;
  font-size: 0.7rem;
  transition: all 0.2s ease;
  min-width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.disclaimer-toggle:hover {
  background: rgba(255, 200, 0, 0.1);
  border-color: rgba(255, 200, 0, 0.6);
}

.disclaimer-arrow {
  transition: transform 0.3s ease;
  display: inline-block;
}

.disclaimer.collapsed .disclaimer-arrow {
  transform: rotate(-90deg);
}

@media (max-width: 768px) {
  .disclaimer {
    font-size: 0.65rem;
    padding: 0.4rem;
    max-height: 120px;
    align-items: flex-start;
  }

  .disclaimer-icon {
    font-size: 0.85rem;
    margin-top: 2px;
  }
  .disclaimer-toggle {
    margin-top: 2px;
  }
}

@media (max-width: 480px) {
  .disclaimer {
    font-size: 0.6rem;
    padding: 0.3rem;
    max-height: 110px;
  }

  .disclaimer-toggle {
    font-size: 0.6rem;
    min-width: 20px;
    height: 20px;
    padding: 0.15rem 0.3rem;
  }
}

/* Markdown Rendering in Chat */
.message.assistant h1,
.message.assistant h2,
.message.assistant h3 {
  margin: 0.5rem 0 0.3rem 0;
  font-weight: bold;
  line-height: 1.3;
}

.message.assistant h1 {
  font-size: 1.2rem;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 0.2rem;
}

.dark-mode .message.assistant h1 {
  border-bottom-color: var(--border-dark);
}

.message.assistant h2 {
  font-size: 1.1rem;
}

.message.assistant h3 {
  font-size: 1rem;
}

.message.assistant p {
  margin: 0.3rem 0;
  line-height: 1.4;
}

.message.assistant strong {
  font-weight: bold;
  color: var(--text-light);
}

.dark-mode .message.assistant strong {
  color: var(--text-dark);
}

.message.assistant em {
  font-style: italic;
  opacity: 0.9;
}

.message.assistant code {
  background: rgba(0, 0, 0, 0.1);
  padding: 0.1rem 0.3rem;
  border-radius: 2px;
  font-family: inherit;
  font-size: 0.85em;
  border: 1px solid var(--border-light);
}

.dark-mode .message.assistant code {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-dark);
}

.message.assistant pre {
  background: var(--bg-light);
  border: 2px inset var(--border-light);
  padding: 0.5rem;
  margin: 0.5rem 0;
  overflow-x: auto;
  border-radius: 2px;
}

.dark-mode .message.assistant pre {
  background: var(--bg-dark);
  border-color: var(--border-dark);
}

.message.assistant pre code {
  background: none;
  border: none;
  padding: 0;
  display: block;
  white-space: pre;
  overflow-x: auto;
}

.message.assistant ul,
.message.assistant ol {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

.message.assistant li {
  margin: 0.2rem 0;
  line-height: 1.4;
}

.message.assistant .md-link {
  color: var(--accent-light);
  text-decoration: underline;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.message.assistant .md-link:hover {
  opacity: 0.8;
  text-decoration: none;
}

.dark-mode .message.assistant .md-link {
  color: var(--accent-dark);
}

.message.assistant .md-link:visited {
  opacity: 0.7;
}

/* Preserve terminal prefix for assistant messages */
.message.assistant::before {
  content: ">> ";
  color: var(--accent-light);
  font-weight: bold;
}

.dark-mode .message.assistant::before {
  color: var(--accent-dark);
}

/* Adjust spacing when markdown elements are present */
.message.assistant > *:first-child {
  margin-top: 0;
}

.message.assistant > *:last-child {
  margin-bottom: 0;
}

@media (max-width: 768px) {
  .message.assistant h1 {
    font-size: 1rem;
  }

  .message.assistant h2 {
    font-size: 0.95rem;
  }

  .message.assistant h3 {
    font-size: 0.9rem;
  }

  .message.assistant pre {
    padding: 0.4rem;
    font-size: 0.8rem;
  }

  .message.assistant ul,
  .message.assistant ol {
    padding-left: 1.2rem;
  }
}

@media (max-width: 480px) {
  .message.assistant code {
    font-size: 0.75em;
  }

  .message.assistant pre {
    padding: 0.3rem;
    font-size: 0.75rem;
  }
}
/* Context Radio Options*/
.context-options {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.context-options > p {
  margin: 0;
  font-weight: normal;
  white-space: nowrap;
}

.context-options input[type="radio"] {
  margin: 0;
  margin-left: 0.3rem;
  cursor: pointer;
  accent-color: var(--accent-light);
}

.dark-mode .context-options input[type="radio"] {
  accent-color: var(--accent-dark);
}

.context-options label {
  cursor: pointer;
  user-select: none;
  transition: color 0.2s ease;
  font-size: 0.9rem;
  margin-right: 0.5rem;
  white-space: nowrap;
}

.context-options label:hover {
  color: var(--accent-light);
}

.dark-mode .context-options label:hover {
  color: var(--accent-dark);
}

/* Mobile responsive */
@media (max-width: 480px) {
  .context-options {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .context-options > p {
    width: 100%;
    margin-bottom: 0.2rem;
  }
}

/* Music Controls Wrapper - Single Row Layout */
.music-controls-wrapper {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.music-controls-left {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.8rem;
  flex-shrink: 0;
}

.music-controls-left > p {
  margin: 0;
  font-weight: normal;
  white-space: nowrap;
}

/* Music Navigation Buttons Container */
.music-navigation {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Navigation and Shuffle Buttons */
.nav-music-btn,
.shuffle-btn,
.play-pause-btn {
  padding: 0.3rem 0.6rem;
  border: 2px outset var(--border-light);
  background: var(--window-bg-light);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 28px;
}

.dark-mode .nav-music-btn,
.dark-mode .shuffle-btn,
.dark-mode .play-pause-btn {
  background: var(--window-bg-dark);
  border-color: var(--border-dark);
  color: var(--text-dark);
}

/* Play/Pause Button */
.play-pause-btn {
  min-width: 36px;
}

.play-pause-btn:hover {
  background: var(--accent-light);
  color: white;
  transform: translateY(-1px);
}

.dark-mode .play-pause-btn:hover {
  background: var(--accent-dark);
}

.play-pause-btn:active {
  border-style: inset;
  transform: translateY(0);
}

/* Disabled state for nav buttons */
.nav-music-btn:disabled,
.shuffle-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.nav-music-btn:not(:disabled):hover,
.shuffle-btn:not(:disabled):hover {
  background: var(--accent-light);
  color: white;
  transform: translateY(-1px);
}

.dark-mode .nav-music-btn:not(:disabled):hover,
.dark-mode .shuffle-btn:not(:disabled):hover {
  background: var(--accent-dark);
}

.nav-music-btn:not(:disabled):active,
.shuffle-btn:not(:disabled):active {
  border-style: inset;
  transform: translateY(0);
}

/* Icons */
.nav-icon,
.shuffle-icon,
.play-pause-icon {
  font-size: 1rem;
  font-weight: bold;
  display: inline-block;
  transition: transform 0.3s ease;
}

.play-pause-icon {
  font-size: 1.1rem;
}

.shuffle-btn:not(:disabled):hover .shuffle-icon {
  transform: rotate(180deg);
}

/* Shuffle Animation */
.shuffle-btn.shuffling .shuffle-icon {
  animation: shuffleSpin 0.3s ease;
}

@keyframes shuffleSpin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Navigation Button Animations */
.nav-music-btn:not(:disabled):active .nav-icon {
  transform: scale(0.9);
}

/* Play/Pause Animation */
.play-pause-btn .play-pause-icon {
  transition: transform 0.2s ease;
}

.play-pause-btn:active .play-pause-icon {
  transform: scale(0.9);
}

/* Music Title Display - Inline with controls */
.music-title-container {
  flex: 1;
  min-width: 200px;
  padding: 0.4rem 0.6rem;
  background: var(--bg-light);
  border: 2px inset var(--border-light);
  height: 28px;
  display: none;
  align-items: center;
  overflow: hidden;
  position: relative;
}

.dark-mode .music-title-container {
  background: var(--bg-dark);
  border-color: var(--border-dark);
}

.music-title-content {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  overflow: hidden;
}

.music-track-number {
  color: var(--accent-light);
  font-weight: bold;
  font-size: 0.75rem;
  flex-shrink: 0;
  min-width: fit-content;
}

.dark-mode .music-track-number {
  color: var(--accent-dark);
}

.music-title-wrapper {
  flex: 1;
  overflow: hidden;
  position: relative;
  height: 16px;
  display: flex;
  align-items: center;
}

.music-title-text {
  display: inline-block;
  white-space: nowrap;
  font-size: 0.75rem;
  color: var(--text-light);
  animation: none;
  position: relative;
}

.dark-mode .music-title-text {
  color: var(--text-dark);
}

/* Marquee animation - starts from right, loops seamlessly */
.music-title-text.marquee {
  animation: marqueeRightToLeft 20s linear infinite;
  padding-right: 50px; /* Space between loop iterations */
}

.music-title-text.marquee::after {
  content: attr(data-text);
  position: absolute;
  left: 100%;
  padding-left: 50px;
  white-space: nowrap;
}

@keyframes marqueeRightToLeft {
  0% {
    transform: translateX(100%);
  }
  100% {
    transform: translateX(-100%);
  }
}

.music-title-text.marquee:hover {
  animation-play-state: paused;
}

.music-duration {
  color: var(--accent-light);
  font-size: 0.7rem;
  flex-shrink: 0;
  font-weight: bold;
  margin-left: 0.5rem;
}

.dark-mode .music-duration {
  color: var(--accent-dark);
}

.music-loading {
  color: var(--text-light);
  font-size: 0.75rem;
  font-style: italic;
  opacity: 0.7;
}

.dark-mode .music-loading {
  color: var(--text-dark);
}

/* Retro terminal styling */
.music-title-container::before {
  content: "♪";
  position: absolute;
  left: 0.2rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  color: var(--accent-light);
  opacity: 0.5;
  animation: pulse 2s ease-in-out infinite;
}

.dark-mode .music-title-container::before {
  color: var(--accent-dark);
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .music-controls-wrapper {
    gap: 0.6rem;
  }

  .music-controls-left {
    gap: 0.6rem;
  }

  .music-navigation {
    gap: 0.3rem;
  }

  .music-title-container {
    min-width: 150px;
    padding: 0.3rem 0.5rem;
  }

  .music-title-text {
    font-size: 0.7rem;
  }

  .music-track-number {
    font-size: 0.7rem;
  }

  .music-duration {
    font-size: 0.65rem;
  }
}

@media (max-width: 480px) {
  .music-controls-wrapper {
    gap: 0.5rem;
    flex-direction: column;
    align-items: stretch;
  }

  .music-controls-left {
    width: 100%;
    justify-content: space-between;
  }

  .music-title-container {
    width: 100%;
    min-width: auto;
    padding: 0.3rem 0.4rem;
  }

  .nav-music-btn,
  .shuffle-btn,
  .play-pause-btn {
    padding: 0.25rem 0.5rem;
    min-width: 28px;
    height: 24px;
  }

  .play-pause-btn {
    min-width: 32px;
  }

  .nav-icon,
  .shuffle-icon {
    font-size: 0.9rem;
  }

  .play-pause-icon {
    font-size: 1rem;
  }

  .music-navigation {
    gap: 0.25rem;
  }

  .music-title-text {
    font-size: 0.65rem;
  }

  .music-track-number {
    font-size: 0.65rem;
  }

  .music-duration {
    font-size: 0.6rem;
  }

  .music-title-container::before {
    font-size: 0.75rem;
  }
}
