@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&display=swap");

:root {
  --page-bg: #ecdeb6;
  --panel-bg: #ecdeb6;
  --terminal-bg: #ecdeb6;
  --text-main: #333333;
  --text-soft: #666666;
  --text-muted: #888888;
  --accent: #e06c4b;
  --line: rgba(224, 108, 75, 0.45);
  --line-soft: rgba(224, 108, 75, 0.3);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
  padding: clamp(1rem, 2vw, 2rem);
  background: var(--page-bg);
  color: var(--text-main);
  font-family: "IBM Plex Mono", monospace;
}

.shell {
  width: min(1320px, 100%);
  height: min(92vh, 980px);
  min-height: 780px;
  margin: 0 auto;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--panel-bg);
  box-shadow: 0 20px 40px rgba(18, 18, 18, 0.15);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: shell-in 0.4s ease;
}

.shell-top {
  display: flex;
  min-height: 360px;
  height: 58%;
  border-bottom: 1px dashed var(--line-soft);
}

.hero {
  flex: 1;
  padding: clamp(1.4rem, 2vw, 2.2rem);
  border-right: 1px dashed var(--line-soft);
  background: #ecdeb6;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  overflow: hidden;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.4rem, 2vw, 2.1rem);
  font-weight: 500;
  color: #1a1a1a;
}

.hero-gif {
  display: block;
  width: clamp(140px, 22vw, 240px);
  height: auto;
  margin-top: 0.6rem;
  border-radius: 8px;
  image-rendering: auto;
  animation: mascot-in 0.5s ease;
}

.model-line,
.path-line {
  margin: 0;
}

.model-line {
  margin-top: 1rem;
  color: var(--text-soft);
  font-size: 0.95rem;
}

.path-line {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.sidebar {
  width: 560px;
  display: grid;
  grid-template-rows: 1fr 1fr;
  min-height: 0;
}

.panel {
  padding: 1rem 1rem 0.85rem;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.panel+.panel {
  border-top: 1px dashed var(--line-soft);
}

.panel h2 {
  margin: 0 0 0.65rem;
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--accent);
}

.panel-toggle {
  width: 100%;
  border: 0;
  margin: 0 0 0.65rem;
  padding: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  cursor: default;
  pointer-events: none;
}

.panel-toggle:focus-visible {
  outline: 2px dashed var(--line);
  outline-offset: 3px;
}

.panel-title {
  font-size: 1.05rem;
  font-weight: 500;
}

.panel-toggle-icon {
  display: none;
  width: 0.58rem;
  height: 0.58rem;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(45deg);
  transition: transform 0.18s ease;
  flex-shrink: 0;
}

.panel-content {
  min-height: 0;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.catalog-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.22rem;
  min-height: 0;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.catalog-btn {
  width: 100%;
  border: 0;
  background: transparent;
  color: #555;
  font: inherit;
  text-align: left;
  padding: 0.25rem 0.35rem;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  transform: translateX(16px);
  opacity: 0;
  animation: list-in 0.28s ease forwards;
  animation-delay: var(--delay, 0ms);
}

.catalog-btn:hover,
.catalog-btn:focus-visible {
  color: #1f1f1f;
  background: #ecdeb6;
  font-weight: 600;
  outline: none;
}

.catalog-btn.active {
  color: #111;
  background: #ecdeb6;
  font-weight: 600;
}

.details-lines {
  min-height: 0;
  overflow-y: auto;
  display: grid;
  gap: 0.3rem;
  padding-right: 0.25rem;
}

.details-line {
  margin: 0;
  color: #555;
  line-height: 1.35;
}

.details-line.command {
  color: #7b8592;
  padding-left: 1.2em;
  text-indent: -1.2em;
}

.details-line a {
  color: inherit;
  text-decoration: none;
}

.hint {
  margin: 0.62rem 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.shell-bottom {
  flex: 0 0 42%;
  min-height: 0;
  background: var(--terminal-bg);
  padding: 1rem 1.1rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.boot-line {
  margin: 0;
  font-size: 1.05rem;
  color: #2e3135;
}

.details-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 0.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.entry {
  margin: 0;
  line-height: 1.55;
  white-space: pre-wrap;
  animation: message-in 0.2s ease;
}

.entry.assistant {
  margin-left: 1rem;
  color: #333;
}

.entry.assistant.typing::after {
  content: "▋";
  margin-left: 2px;
  animation: typing-caret 0.9s steps(1, end) infinite;
}

.entry.user {
  color: var(--accent);
}

.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  margin-left: 1rem;
  color: var(--text-muted);
}

.typing-indicator .dot {
  width: 0.34rem;
  height: 0.34rem;
  border-radius: 50%;
  background: var(--text-muted);
  opacity: 0.4;
  animation: typing-dot 1s ease-in-out infinite;
}

.typing-indicator .dot:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-indicator .dot:nth-child(3) {
  animation-delay: 0.3s;
}

.prompt {
  margin-top: auto;
  border-top: 1px solid var(--line-soft);
  padding-top: 0.55rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.prompt-mark {
  color: var(--accent);
  font-size: 1.2rem;
  font-weight: 700;
}

#query-input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  color: var(--text-main);
  caret-color: var(--accent);
}

#query-input::placeholder {
  color: var(--text-muted);
}

#query-input:disabled {
  color: var(--text-muted);
}

.mode-indicator {
  flex-shrink: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  border: 1px dashed var(--line-soft);
  border-radius: 999px;
  padding: 0.14rem 0.52rem;
  white-space: nowrap;
}

.mode-indicator.interviewer {
  color: #8c4d35;
  border-color: rgba(224, 108, 75, 0.55);
  background: rgba(224, 108, 75, 0.12);
}

.command-suggestions {
  margin-top: 0.45rem;
  border: 1px dashed var(--line-soft);
  border-radius: 8px;
  padding: 0.3rem;
  display: grid;
  gap: 0.2rem;
  background: rgba(236, 222, 182, 0.6);
}

.command-suggestion-btn {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text-main);
  font: inherit;
  text-align: left;
  border-radius: 6px;
  padding: 0.24rem 0.42rem;
  cursor: pointer;
}

.command-suggestion-btn:hover,
.command-suggestion-btn:focus-visible {
  background: rgba(224, 108, 75, 0.12);
  outline: none;
}

.command-suggestion-name {
  color: #5d6470;
  font-weight: 600;
  margin-right: 0.45rem;
}

.command-suggestion-desc {
  color: var(--text-muted);
}

.catalog-list::-webkit-scrollbar,
.details-lines::-webkit-scrollbar,
.details-body::-webkit-scrollbar {
  width: 8px;
}

.catalog-list::-webkit-scrollbar-thumb,
.details-lines::-webkit-scrollbar-thumb,
.details-body::-webkit-scrollbar-thumb {
  background: rgba(136, 136, 136, 0.4);
  border-radius: 999px;
}

@media (max-width: 1280px) {
  .shell {
    width: min(1200px, 100%);
  }

  .sidebar {
    width: 500px;
  }
}

@media (max-width: 960px) {
  .shell {
    height: auto;
    min-height: 0;
  }

  .shell-top {
    height: auto;
    flex-direction: column;
  }

  .hero {
    border-right: 0;
    border-bottom: 1px dashed var(--line-soft);
    min-height: 280px;
  }

  .sidebar {
    width: 100%;
    grid-template-rows: auto auto;
  }

  .panel {
    min-height: 180px;
  }

  .panel[data-collapsible] {
    min-height: 0;
  }

  .panel-toggle {
    pointer-events: auto;
    cursor: pointer;
    margin-bottom: 0.15rem;
    padding: 0.2rem 0;
  }

  .panel-toggle-icon {
    display: inline-block;
  }

  .panel.panel-collapsed .panel-toggle-icon {
    transform: rotate(-45deg);
  }

  .panel.panel-collapsed .panel-content {
    display: none;
  }

  .shell-bottom {
    flex: initial;
    min-height: 300px;
    height: 46vh;
    max-height: 520px;
    overflow: hidden;
  }

  .catalog-btn {
    white-space: normal;
    text-overflow: clip;
    overflow: visible;
    line-height: 1.35;
  }
}

@media (max-width: 600px) {
  body {
    padding: 0.7rem;
  }

  .hero,
  .shell-bottom,
  .panel {
    padding-left: 0.8rem;
    padding-right: 0.8rem;
  }

  .hero-gif {
    width: clamp(120px, 35vw, 180px);
  }

  .hero h1 {
    font-size: clamp(1.2rem, 7vw, 1.6rem);
  }

  .prompt {
    flex-wrap: wrap;
    row-gap: 0.4rem;
    column-gap: 0.45rem;
  }

  .prompt-mark {
    order: 1;
  }

  #query-input {
    order: 2;
    width: calc(100% - 1.5rem);
  }

  .mode-indicator {
    order: 3;
    margin-left: 1.5rem;
    font-size: 0.74rem;
    padding: 0.1rem 0.4rem;
  }

  .command-suggestions {
    padding: 0.24rem;
  }

  .command-suggestion-btn {
    padding: 0.22rem 0.34rem;
  }

  .boot-line {
    font-size: 0.95rem;
  }

  .shell-bottom {
    height: 52vh;
    min-height: 280px;
    max-height: 460px;
    overflow: hidden;
  }

  .details-body {
    min-height: 0;
    overflow-y: auto;
  }

  .entry {
    line-height: 1.45;
  }
}

@keyframes shell-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes mascot-in {
  from {
    opacity: 0;
    transform: scale(0.7);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes list-in {
  from {
    opacity: 0;
    transform: translateX(16px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes message-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes typing-dot {

  0%,
  80%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }

  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

@keyframes typing-caret {
  0%,
  49% {
    opacity: 1;
  }

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