@font-face {
  font-family: 'Pagkaki';
  src: url('/static/fonts/PAGKAKI-Regular.ttf') format('truetype');
  font-display: swap;
}

:root {
  --indigo: #30197C;
  --cyan: #41C5EE;
  --magenta: #ff0082;
  --amber: #ffd200;
  --panel-bg: #eef1f7;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--panel-bg);
  color: #1b2030;
}

.toky-title { font-family: 'Pagkaki', Georgia, serif; letter-spacing: .5px; }

/* ── Start screen ── */
.start-screen {
  height: 100%;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.start-card {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(48, 25, 124, .2);
  padding: 36px 32px;
  width: 100%;
  max-width: 360px;
  text-align: center;
}
.start-logo { height: 34px; margin-bottom: 14px; }
.start-card h1 { color: var(--indigo); font-size: 40px; margin: 4px 0; }
.start-sub { color: #6b7280; margin: 0 0 22px; font-size: 14px; }
.start-form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.start-form label { font-size: 13px; color: var(--indigo); font-weight: 600; display: flex; flex-direction: column; gap: 6px; }
.start-form input {
  border: 2px solid #dfe3ee; border-radius: 12px; padding: 11px 14px; font-size: 15px;
}
.start-form input:focus { outline: none; border-color: var(--cyan); }
.btn-primary {
  margin-top: 6px; border: none; border-radius: 14px; padding: 13px;
  background: var(--cyan); color: #fff; font-size: 17px; cursor: pointer;
}
.start-error { color: var(--magenta); font-size: 13px; margin: 0; }

/* ── Chat shell ── */
.chat-shell {
  max-width: 920px; margin: 0 auto; height: 100%;
  display: flex; flex-direction: column; overflow: hidden;
}
.chat-header {
  background: var(--indigo); position: relative; min-height: 116px;
  padding: 0 26px; display: flex; align-items: center; gap: 16px;
}
.header-logo { height: 34px; }
.header-titles { color: #fff; }
.header-name { font-size: 24px; }
.header-meta { font-size: 12px; opacity: .85; }
.mascot {
  position: absolute; right: 80px; bottom: 4px; height: 106px; z-index: 5;
  filter: drop-shadow(0 6px 8px rgba(48, 25, 124, .35));
  pointer-events: none;
}

.chat-panel {
  background: #fff; flex: 1; border-radius: 18px 18px 0 0;
  margin-top: -6px; padding: 26px 24px 0; display: flex; flex-direction: column;
  overflow: hidden;
}
.messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; width: 100%; padding-bottom: 8px; }

.bubble { max-width: 78%; border-radius: 14px; padding: 12px 14px; font-size: 14px; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; }
.bubble.tutor { align-self: flex-start; background: #f5f7fb; border-radius: 14px 14px 14px 4px; }
.bubble.student { align-self: flex-end; background: var(--indigo); color: #fff; border-radius: 14px 14px 4px 14px; }
.bubble img { display: block; max-width: 100%; border-radius: 9px; margin-top: 8px; }
.bubble.typing { color: #8a93a6; font-style: italic; }
.speak-btn {
  display: block; margin-top: 6px; padding: 0; cursor: pointer;
  background: none; border: none; color: #9aa3b5;
}
.speak-btn:hover { color: var(--indigo); }
.speak-btn svg { width: 16px; height: 16px; display: block; }

.input-bar {
  flex-shrink: 0; background: #fff; padding: 14px 0;
  margin-top: 10px; border-top: 1px solid #eef1f7;
  display: flex; align-items: center; gap: 8px; width: 100%;
}
.icon-btn {
  cursor: pointer; background: none; border: none; color: var(--indigo);
  display: flex; align-items: center; justify-content: center; padding: 7px;
  border-radius: 50%; flex-shrink: 0; transition: background .15s;
}
.icon-btn:hover { background: #eef1f7; }
.icon-btn svg { width: 23px; height: 23px; display: block; }
.icon-btn.recording { color: var(--magenta); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }
.text-input {
  flex: 1; min-width: 0; background: #eef1f7; border: none; border-radius: 22px;
  padding: 12px 18px; font-size: 14px;
}
.text-input:focus { outline: none; }
.btn-send {
  border: none; border-radius: 50%; width: 44px; height: 44px; flex-shrink: 0;
  background: var(--cyan); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: background .15s;
}
.btn-send:hover { background: var(--indigo); }
.btn-send svg { width: 22px; height: 22px; display: block; }
.attachment-chip {
  align-self: flex-start; background: #fff6f9; color: var(--magenta);
  border: 1px dashed var(--magenta); border-radius: 8px;
  padding: 4px 10px; font-size: 12px; margin: 0 0 10px;
}

@media (max-width: 600px) {
  .mascot { right: 16px; height: 92px; bottom: 4px; }
  .chat-panel { padding: 20px 14px 0; }
  .header-name { font-size: 20px; }
}

/* ── Teacher tools (chat sandbox) ── */
.teacher-tools { display: flex; gap: 8px; padding: 10px 0 4px; flex-wrap: wrap; }
.teacher-tools .tt-btn {
  border: 1px solid #dfe3ee; border-radius: 999px; padding: 6px 15px; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--indigo); background: #fff;
  transition: all .15s;
}
.teacher-tools .tt-btn:hover { background: var(--indigo); color: #fff; border-color: var(--indigo); }

/* ── Global view nav (floats, never reflows the full-height screens) ── */
.view-nav {
  position: fixed; top: 8px; right: 10px; z-index: 1000;
  display: flex; gap: 6px;
  background: rgba(255, 255, 255, 0.9); border: 1px solid #e3e7f2;
  border-radius: 999px; padding: 4px 6px;
  box-shadow: 0 2px 8px rgba(48, 25, 124, 0.12);
}
.view-nav a {
  font-size: 12px; font-weight: 600; text-decoration: none; color: var(--indigo);
  padding: 4px 10px; border-radius: 999px;
}
.view-nav a:hover { background: var(--cyan); color: #fff; }
