:root {
  --color-stone-50: oklch(0.985 0.001 106.423);
  --color-stone-100: oklch(0.97 0.001 106.424);
  --color-stone-200: oklch(0.923 0.003 48.717);
  --color-stone-300: oklch(0.869 0.005 56.366);
  --color-stone-400: oklch(0.709 0.01 56.259);
  --color-stone-500: oklch(0.553 0.013 58.071);
  --color-stone-600: oklch(0.444 0.011 73.639);
  --color-stone-700: oklch(0.374 0.01 67.558);
  --color-stone-800: oklch(0.268 0.007 34.298);
  --color-stone-900: oklch(0.216 0.006 56.043);
  --color-stone-950: oklch(0.147 0.004 49.25);

  font-size: 16px;

  @media screen and (min-width: 600px) {
    font-size: 17px;
  }
  @media screen and (min-width: 992px) {
    font-size: 18px;
  }
  @media screen and (min-width: 1280px) {
    font-size: 19px;
  }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Funnel", sans-serif;
}

body {
  background: var(--color-stone-100);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--color-stone-700);
}

.button-icon {
  color: var(--color-stone-800);
  font-size: 1.5rem;
}

.container {
  width: 100%;
  max-width: 800px;
  display: flex;
  flex-direction: column;
  height: 100vh;
  justify-content: end;
}

main {
  overflow: scroll;
  margin-bottom: calc(30px + 0.8rem);
}

header {
  padding: 25px 30px;
  text-align: center;
}

header h1 {
  font-size: 1.8rem;
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.subtitle {
  font-size: 0.95rem;
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.5;
}

.chat-history {
  flex: 1;
  padding: 25px 30px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.message {
  max-width: 85%;
  padding: 18px 20px;
  line-height: 1.5;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.user-message {
  align-self: flex-end;
  background: var(--color-stone-200);
  color: var(--color-stone-950);
  border: 1px solid var(--color-stone-400);
}

.tutor-message {
  align-self: flex-start;
  color: var(--color-stone-800);
  white-space: pre-wrap; /* Preserves formatting from AI */
}

.input-area {
  padding: 20px 30px;
  border-top: 1px solid var(--color-stone-300);
}

.input-wrapper {
  display: flex;
  gap: 15px;
  align-items: flex-end;
}

textarea {
  flex: 1;
  padding: 16px;
  border: 1px solid var(--color-stone-300);
  font-size: 1rem;
  resize: none;
  transition: border 0.3s;
  outline: none;
  line-height: 1.5;
}

textarea:focus {
  border-color: var(--color-stone-400);
}

button {
  background: var(--color-stone-200);
  color: var(--color-stone-100);
  border: solid 1px var(--color-stone-400);
  width: 50px;
  height: 50px;
  cursor: pointer;
  font-size: 1.2rem;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
}

button:hover,
button:focus-visible {
  background-color: var(--color-stone-300);
  border-color: var(--color-stone-400);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

button:first-of-type {
  margin-bottom: calc(0.35rem);

  @media screen and (min-width: 600px) {
    margin-bottom: calc(0.35rem + 4px);
  }

  @media screen and (min-width: 992px) {
    margin-bottom: calc(0.35rem + 8px);
  }

  @media screen and (min-width: 1280px) {
    margin-bottom: calc(0.35rem + 12px);
  }
}

.hint {
  margin-top: 15px;
  font-size: 0.85rem;
  color: var(--color-stone-700);
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: center;
}

footer {
  text-align: center;
  padding: 15px;
  font-size: 0.8rem;
  color: var(--color-stone-700);
  border-top: 1px solid var(--color-stone-300);
  background: var(--color-stone-100);
  width: 100vw;
  position: fixed;
  bottom: 0;
  left: 0;
}

#status {
  font-weight: 600;
  color: #4776e6;
}
