/* -- Mans MI Skolotajs — "Krits" light neo-brutalist theme --- */

:root {
  --bg:      #fdf6ec;
  --ink:     #191919;
  --text-2:  #555555;
  --card:    #ffffff;
  --yellow:  #ffd43b;
  --pink:    #ffb3c1;
  --blue:    #a5d8ff;
  --green:   #b9f18d;
  --red:     #ff8787;
  --radius:  14px;
  --shadow:  4px 4px 0 var(--ink);
}

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

html, body { height: 100%; }

body {
  font-family: "Outfit", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

#app { max-width: 780px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }

/* -- Setup screens ------------------------------------------- */

.screen {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 32px 20px 44px; text-align: center;
  animation: rise .25s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.logo {
  display: inline-block; background: var(--yellow);
  border: 3px solid var(--ink); border-radius: 12px;
  padding: 10px 18px; font-weight: 900; font-size: 20px;
  box-shadow: 5px 5px 0 var(--ink); margin-bottom: 26px;
  transform: rotate(-2deg);
}

h1 { font-family: "Archivo Black", "Outfit", sans-serif; font-size: 38px; letter-spacing: -1px; }
.tagline { font-size: 16px; color: var(--text-2); margin: 10px 0 42px; }

h2.question {
  font-size: 20px; font-weight: 700; margin-bottom: 28px;
  background: var(--green); display: inline-block; padding: 5px 16px;
  border: 3px solid var(--ink); border-radius: 10px; transform: rotate(1deg);
}

.grid { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; max-width: 660px; }

.big-btn {
  border: 3px solid var(--ink);
  background: var(--card);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 14px 24px;
  font-size: 17px; font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .12s ease, box-shadow .12s ease;
  font-family: inherit;
}
.big-btn:hover  { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.big-btn:active { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--ink); }

/* candy coloring — every grid gets a repeating pattern */
.grid .big-btn:nth-child(5n+1) { background: var(--pink); }
.grid .big-btn:nth-child(5n+3) { background: var(--blue); }
.grid .big-btn:nth-child(5n+5) { background: var(--yellow); }

.big-btn .sub { display: block; font-size: 13px; font-weight: 500; color: #333; margin-top: 5px; }

.big-btn.card { width: 200px; padding: 18px 16px; }

.back-link {
  margin-top: 32px; background: none; border: none; cursor: pointer;
  color: var(--text-2); font-size: 15px; font-weight: 700; font-family: inherit;
  text-decoration: underline; text-underline-offset: 3px;
}
.back-link:hover { color: var(--ink); }

.custom-row { display: flex; gap: 10px; margin-top: 20px; width: 100%; max-width: 460px; }
.custom-row input {
  flex: 1; border: 3px solid var(--ink); border-radius: var(--radius);
  padding: 13px 16px; font-size: 16px; font-family: inherit; font-weight: 600;
  color: var(--ink); outline: none; background: var(--card);
  box-shadow: var(--shadow);
}
.custom-row input::placeholder { color: #999; font-weight: 500; }
.custom-row input:focus { background: #fffbe9; }
.custom-row .big-btn { background: var(--yellow); }

/* -- Chat screen --------------------------------------------- */

.chat-wrap { flex: 1; display: flex; flex-direction: column; height: 100dvh; }

.chat-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: var(--card);
  border-bottom: 3px solid var(--ink);
  position: sticky; top: 0; z-index: 5;
}
.chat-title { flex: 1; min-width: 0; }
.chat-title .t1 { font-weight: 900; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-title .t2 { font-size: 12px; font-weight: 600; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.icon-btn {
  border: 3px solid var(--ink); background: var(--card); color: var(--ink);
  border-radius: 10px; font-size: 14px; font-weight: 700; padding: 8px 12px;
  cursor: pointer; font-family: inherit; line-height: 1;
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform .1s ease, box-shadow .1s ease;
}
.icon-btn:hover  { transform: translate(1px, 1px); box-shadow: 2px 2px 0 var(--ink); }
.icon-btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.icon-btn.off { opacity: .4; }
.icon-btn.voice { background: var(--yellow); }
.icon-btn.end   { background: var(--pink); }

.chat-body { flex: 1; overflow-y: auto; padding: 18px 16px 10px; display: flex; flex-direction: column; gap: 12px; }

.msg {
  max-width: 82%; padding: 12px 16px;
  border: 3px solid var(--ink); border-radius: var(--radius);
  font-size: 16px; font-weight: 500; line-height: 1.5;
  white-space: pre-wrap; word-wrap: break-word;
  animation: rise .18s ease;
}
.msg.ai {
  background: var(--card); align-self: flex-start;
  border-bottom-left-radius: 4px; box-shadow: var(--shadow);
}
.msg.user {
  background: var(--blue); align-self: flex-end; font-weight: 600;
  border-bottom-right-radius: 4px; box-shadow: var(--shadow);
}
.msg.ai h3 { font-size: 17px; font-weight: 900; margin: 4px 0 6px; background: var(--yellow); display: inline-block; padding: 1px 8px; border-radius: 6px; }
.msg.ai b  { background: var(--green); padding: 0 4px; border-radius: 4px; }

.msg.typing { color: var(--text-2); font-style: italic; box-shadow: none; border-style: dashed; }
.msg.error  { background: var(--red); }

.options { display: flex; flex-wrap: wrap; gap: 10px; align-self: flex-start; max-width: 90%; }
.opt-btn {
  border: 3px solid var(--ink); background: var(--yellow); color: var(--ink);
  border-radius: 12px; padding: 11px 18px;
  font-size: 16px; font-weight: 700; cursor: pointer; font-family: inherit;
  box-shadow: var(--shadow);
  transition: transform .12s ease, box-shadow .12s ease;
}
.opt-btn:nth-child(2n) { background: var(--green); }
.opt-btn:hover  { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.opt-btn:active { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--ink); }

.chat-input {
  display: flex; gap: 10px; padding: 12px 16px 16px;
  background: var(--card); border-top: 3px solid var(--ink);
  position: sticky; bottom: 0;
}
.chat-input input {
  flex: 1; border: 3px solid var(--ink); border-radius: 12px;
  padding: 12px 16px; font-size: 16px; font-weight: 600; font-family: inherit;
  color: var(--ink); outline: none; background: var(--bg);
}
.chat-input input::placeholder { color: #999; font-weight: 500; }
.chat-input input:focus { background: #fffbe9; }
.send-btn {
  border: 3px solid var(--ink); background: var(--green); color: var(--ink);
  border-radius: 12px; font-size: 16px; font-weight: 900; padding: 0 22px;
  cursor: pointer; font-family: inherit; box-shadow: 3px 3px 0 var(--ink);
  transition: transform .1s ease, box-shadow .1s ease;
}
.send-btn:hover  { transform: translate(1px, 1px); box-shadow: 2px 2px 0 var(--ink); }
.send-btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.send-btn:disabled { opacity: .5; }

/* small screens */
@media (max-width: 480px) {
  h1 { font-size: 30px; }
  .big-btn.card { width: 46%; padding: 14px 10px; font-size: 15px; }
}
