@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;380;400;500;600;700&display=swap');

:root {
  --primary-cream: #FFFEF9;
  --primary-light-blue: #CAE2F5;
  --primary-blue: #6F89B1;
  --secondary-blue: #E0EEF9;
  --text-black: #000000;
  --text-grey: #848484;
  --bg-input: #EFEFEF;
  --border-radius-card: 16px;
  --border-radius-pill: 50px;
}

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

body {
  font-family: 'Sarabun', sans-serif;
  font-weight: 380;
  background-color: #f0f0f0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  color: var(--text-black);
  line-height: 1.6;
  letter-spacing: 0.3px;
}

h1,
h2,
h3,
h4,
.semibold,
strong {
  font-weight: 600;
}

a {
  text-decoration: none;
  color: inherit;
}

.mobile-container {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  background-color: var(--primary-cream);
  position: relative;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.bg-blue {
  background-color: var(--primary-blue);
  color: white;
}

/* Headers & Text Fields */
.header-title {
  text-align: center;
  font-size: 24px;
  margin-top: 40px;
  margin-bottom: 30px;
}

.title-large-cream {
  font-size: 30px;
  color: var(--primary-cream);
  text-align: center;
  font-weight: 380;
  line-height: 1.6;
  margin-top: 10px;
  margin-bottom: 30px;
}

.sub-title {
  text-align: center;
  font-size: 18px;
  margin-bottom: 20px;
}

.content-padding {
  padding: 24px 36px;
}

/* Buttons */
.btn {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 208px;
  height: 48px;
  margin: 0 auto;
  padding: 0;
  border: none;
  border-radius: var(--border-radius-pill);
  font-family: 'Sarabun', sans-serif;
  font-size: 20px;
  font-weight: 380;
  cursor: pointer;
  /* transition: all 0.2s ease; */
}

.btn:hover {
  opacity: 0.9;
  /* transform: scale(1.05);  */
}

.btn-primary {
  background-color: var(--primary-blue);
  color: white;
}

.btn-secondary {
  background-color: var(--primary-light-blue);
  color: var(--primary-blue);
}

.btn-blue-outline {
  background-color: white;
  color: var(--primary-blue);
}

.btn-white {
  background-color: white;
  color: var(--primary-blue);
}

/* Form Inputs */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 14px;
  color: var(--text-grey);
  margin-bottom: 8px;
  margin-left: 12px;
}

.form-input {
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: var(--border-radius-pill);
  background-color: var(--bg-input);
  font-family: 'Sarabun', sans-serif;
  font-size: 16px;
  color: var(--text-black);
  outline: none;
}

.form-input::placeholder {
  color: #B0B0B0;
}

/* Character Image Containers */
.character-greeting {
  display: flex;
  align-items: center;
  padding: 60px 24px 0 0;
  /* Match layout by removing left padding */
  margin-bottom: -30px;
  /* Overlap more so it tucks properly under the panel */
  z-index: 1;
  /* Drop behind blue panel */
  position: relative;
}

.character-img-greeting-container {
  width: 140px;
  /* Restrict width */
  height: 220px;
  /* Restrict height to cause clipping at bottom */
  overflow: hidden;
  /* Hide the rest of the body */
  position: relative;
  z-index: 2;
  /* Drop behind blue panel */
  margin-left: 35px;
}

.character-img-greeting {
  width: 150px;
  /* Maintain original aspect ratio width */
  height: auto;
  position: absolute;
  top: 0;
  left: 0px;
  /* Shift to center character horizontally in masked area */
}

.greeting-text {
  font-size: 20px;
  font-weight: 380;
  color: var(--text-black);
  margin-left: 30px;
  line-height: 1.8;
  margin-top: -80px;
}

.character-top {
  display: flex;
  justify-content: center;
  margin-top: 40px;
  margin-bottom: -15px;
  /* Overlap with blue card */
  z-index: 10;
  position: relative;
}

.character-img {
  width: 120px;
  height: auto;
}

.speech-bubble-side {
  position: absolute;
  right: 15%;
  top: 30%;
  background: white;
  padding: 10px 16px;
  border-radius: 20px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
  font-size: 14px;
  font-weight: 600;
}

/* Cards */
.blue-panel {
  background-color: var(--primary-blue);
  color: white;
  border-top-left-radius: 30px;
  border-top-right-radius: 30px;
  flex: 1;
  padding: 40px 24px 40px 24px;
  /* Increase top padding slightly so text doesn't overlap the character */
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 5;
  /* Raise above character-greeting container */
}

.blue-panel-center {
  background-color: var(--primary-blue);
  color: white;
  border-radius: 20px;
  padding: 40px 24px;
  margin: 0 24px;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 5;
}

/* List for Categories */
.category-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 20px;
  padding: 0 24px;
}

.category-card {
  background-color: var(--primary-cream);
  border-radius: 20px;
  padding: 16px;
  color: var(--text-black);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.category-img {
  width: 100%;
  height: 170px;
  object-fit: cover;
  background-color: #e0e0e0;
  border-radius: 12px;
}

.category-bottom-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 16px;
  padding-bottom: 4px;
}

.category-title {
  padding: 0 8px;
  font-size: 20px;
  font-weight: 380;
  text-align: left;
}

.category-start-btn {
  background-color: var(--primary-light-blue);
  color: var(--text-black);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 16px;
  font-weight: 380;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.2s ease, background-color 0.2s ease;
  /* Add transition */
}

.category-start-btn:hover {
  transform: scale(1.05);
  /* Scale up by 5% */
}

.category-start-icon::before {
  content: "";
  display: inline-block;
  width: 20px;
  height: 20px;
  background-image: url('data:image/svg+xml;utf8,<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="10"></circle><polyline points="12 16 16 12 12 8"></polyline><line x1="8" y1="12" x2="16" y2="12"></line></svg>');
  background-size: contain;
  background-repeat: no-repeat;
  transform: translateY(3px);
  transition: transform 0.2s ease;
  /* Add transition for icon */
}

.category-start-btn:hover .category-start-icon::before {
  transform: translateY(3px) translateX(3px);
  /* Shift slightly to the right while keeping vertical sync */
}

/* Navigation and Tops */
.top-nav {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  color: white;
}

.back-btn {
  font-size: 14px;
  color: inherit;
  display: flex;
  align-items: center;
  gap: 4px;
}

.rating-radio:checked+.rating-circle {
  background-color: var(--primary-blue);
  box-shadow: inset 0 0 0 4px var(--primary-cream);
}

.question-card {
  background-color: var(--primary-light-blue);
  border-radius: 20px;
  margin-bottom: 24px;
  color: var(--text-black);
}

.question-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px 10px 24px;
}

.question-card-label {
  font-size: 18px;
  font-weight: 380;
  color: var(--text-black);
}

.question-card-body {
  background-color: var(--primary-cream);
  border-radius: 20px;
  padding: 24px 20px 24px 20px;
}

.read-aloud-btn {
  background-color: var(--primary-blue);
  color: white;
  border: none;
  border-radius: 20px;
  width: 60px;
  height: 32px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.read-aloud-btn:active {
  transform: scale(0.95);
}

.read-aloud-btn svg {
  width: 18px;
  height: 18px;
}

.question-title {
  font-size: 20px;
  font-weight: 380;
  margin-bottom: 32px;
}

.rating-scale {
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
}

.rating-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.rating-circle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.rating-circle svg {
  width: 100%;
  height: 100%;
  transition: all 0.2s ease;
}

.icon-face {
  width: 60px;
  height: 60px;
  background-color: var(--primary-blue);
  mask-size: cover;
  -webkit-mask-size: cover;
  mask-repeat: no-repeat;
  -webkit-mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-position: center;
  transition: all 0.2s ease;
}

.icon-sad {
  mask-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="1.1" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="10"></circle><path d="M16 17s-1.5-2-4-2-4 2-4 2"></path><circle cx="9" cy="11.5" r="1" fill="black" stroke="none"></circle><circle cx="15" cy="11.5" r="1" fill="black" stroke="none"></circle></svg>');
  -webkit-mask-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="1.1" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="10"></circle><path d="M16 17s-1.5-2-4-2-4 2-4 2"></path><circle cx="9" cy="11.5" r="1" fill="black" stroke="none"></circle><circle cx="15" cy="11.5" r="1" fill="black" stroke="none"></circle></svg>');
}

.icon-neutral {
  mask-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="1.1" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="10"></circle><line x1="9" y1="16" x2="15" y2="16"></line><circle cx="9" cy="11.5" r="1" fill="black" stroke="none"></circle><circle cx="15" cy="11.5" r="1" fill="black" stroke="none"></circle></svg>');
  -webkit-mask-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="1.1" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="10"></circle><line x1="9" y1="16" x2="15" y2="16"></line><circle cx="9" cy="11.5" r="1" fill="black" stroke="none"></circle><circle cx="15" cy="11.5" r="1" fill="black" stroke="none"></circle></svg>');
}

.icon-smile {
  mask-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="1.1" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="10"></circle><path d="M8 15.5s1.5 2 4 2 4-2 4-2"></path><circle cx="9" cy="11.5" r="1" fill="black" stroke="none"></circle><circle cx="15" cy="11.5" r="1" fill="black" stroke="none"></circle></svg>');
  -webkit-mask-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="1.1" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="10"></circle><path d="M8 15.5s1.5 2 4 2 4-2 4-2"></path><circle cx="9" cy="11.5" r="1" fill="black" stroke="none"></circle><circle cx="15" cy="11.5" r="1" fill="black" stroke="none"></circle></svg>');
}

.rating-radio {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  cursor: pointer;
}

.rating-radio:focus+.rating-circle {
  filter: drop-shadow(0 0 0 3px rgba(111, 137, 177, 0.3));
}

.rating-radio:checked+.rating-circle {
  transform: scale(1.1);
}

.rating-radio:checked+.rating-circle svg circle {
  fill: var(--primary-blue);
  stroke: var(--primary-blue);
}

.rating-radio:checked+.rating-circle svg path,
.rating-radio:checked+.rating-circle svg circle:not(:first-child) {
  stroke: var(--primary-cream);
  fill: var(--primary-cream);
}

.rating-radio:checked+.rating-circle>.icon-face {
  background-color: var(--primary-cream);
}

.rating-radio:checked+.rating-circle {
  background-color: var(--primary-blue);
  box-shadow: inset 0 0 0 2px var(--primary-cream);
}

.rating-label {
  font-size: 16px;
  color: var(--text-black);
  text-align: center;
  line-height: 1.4;
}

/* Practice View */
.practice-scene-container {
  position: relative;
  width: 100%;
}

.practice-scene-img {
  width: calc(100% - 48px);
  height: 240px;
  margin: 60px 24px 0 24px;
  object-fit: cover;
  border-radius: 16px;
}

.practice-location-pill {
  position: absolute;
  bottom: 16px;
  left: 36px;
  background-color: var(--primary-cream);
  color: var(--text-black);
  padding: 6px 16px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 380;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  z-index: 10;
}

.practice-dialogue-section {
  position: relative;
  margin: 20px 24px 0 24px;
  height: 200px;
  z-index: 1;
}

.practice-dialogue-card {
  position: absolute;
  right: 0;
  top: 0;
  width: calc(100% - 30px);
  background-color: var(--primary-cream);
  border: 1px solid #738EAD;
  border-radius: 16px;
  padding: 16px 20px 24px 110px;
  min-height: 170px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.practice-character-container {
  position: absolute;
  left: -15px;
  bottom: -12px;
  width: 140px;
  height: 220px;
  overflow: hidden;
  z-index: 2;
  pointer-events: none;
}

.practice-dialogue-avatar {
  width: 140px;
  height: auto;
  position: absolute;
  top: 0;
  left: 0px;
}

.dialogue-speaker {
  font-size: 16px;
  color: var(--text-grey);
  margin-bottom: 8px;
}

.dialogue-speech {
  font-size: 20px;
  font-weight: 380;
  line-height: 1.5;
  color: var(--text-black);
}

.dialogue-speech-user {
  font-size: 24px;
  font-weight: 380;
  line-height: 1.4;
  color: var(--text-black);
  margin-top: 16px;
}

.user-practice-panel {
  background-color: var(--primary-light-blue);
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  flex: 1;
  padding: 24px 24px;
  margin-top: -5px;
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
}

.user-practice-card {
  background-color: var(--primary-cream);
  border-radius: 16px;
  padding: 20px 24px 144px 24px;
  position: relative;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.input-prompt {
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  color: var(--text-black);
}

.mic-button-wrapper {
  position: absolute;
  bottom: -35px;
  left: 50%;
  transform: translateX(-50%);
}

.mic-button {
  width: 70px;
  height: 70px;
  background-color: var(--primary-blue);
  color: white;
  border-radius: 50%;
  border: none;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 10px rgba(111, 137, 177, 0.4);
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.mic-button.listening {
  background-color: white;
  animation: mic-ripple 1.5s infinite;
}

.mic-button.listening svg {
  stroke: var(--primary-blue) !important;
}

@keyframes mic-ripple {
  0% {
    box-shadow: 0 0 0 0 rgba(111, 137, 177, 0.6);
  }

  50% {
    box-shadow: 0 0 0 10px rgba(111, 137, 177, 0.4);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(111, 137, 177, 0.6);
  }
}


/* Result Header */
.character-result-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 16px 15px 32px;
  margin-top: 40px;
  margin-bottom: -15px;
  position: relative;
  z-index: 10;
}

.character-result-img-container {
  width: 140px;
  height: 180px;
  overflow: hidden;
  position: relative;
  margin-right: 24px;
  flex-shrink: 0;
}

.character-result-img {
  width: 150px;
  height: auto;
  position: absolute;
  top: 0;
  left: -5px;
}

.character-result-text {
  font-size: 20px;
  line-height: 1.5;
  color: var(--text-black);
  margin-top: -40px;
  font-weight: 400;
}

/* Result Trophy */
.result-trophy-container {
  text-align: center;
  margin-top: 8px;
  margin-bottom: 8px;
  position: relative;
}



.result-trophy-img {
  width: 200px;
  height: auto;
  position: relative;
  z-index: 2;
}

/* Result Progress Cards */
.result-progress-card {
  padding: 16px 20px;
  border-radius: 20px;
  margin-bottom: 16px;
  background-color: var(--primary-cream);
  position: relative;
  overflow: hidden;
  text-align: left;
}

.result-progress-badge {
  background-color: var(--primary-blue);
  color: white;
  border-radius: 20px;
  padding: 4px 16px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 16px;
  margin-bottom: 16px;
}

.result-progress-data-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 12px;
}

.result-progress-label {
  font-size: 16px;
  color: var(--text-black);
  line-height: 1.4;
  flex: 1;
}

.result-progress-value-box {
  background-color: var(--secondary-blue);
  border-radius: 16px;
  padding: 16px 20px;
  text-align: center;
  min-width: 120px;
  flex-shrink: 0;
}

.result-progress-value-text {
  font-size: 32px;
  font-weight: 380;
  color: var(--text-black);
  line-height: 1;
}

.result-bars-wrapper {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.result-bar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.result-bar-label {
  font-size: 16px;
  color: var(--text-black);
  width: 60px;
}

.result-bar-track {
  flex: 1;
  height: 28px;
  background-color: #D9D9D9;
  border-radius: 24px;
  margin-left: 12px;
  position: relative;
  overflow: hidden;
}

.result-bar-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background-color: var(--primary-blue);
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 12px;
  box-sizing: border-box;
}

.result-bar-text {
  font-size: 14px;
  font-weight: 380;
  color: white;
  z-index: 2;
}

/* Result Detail Card */
.result-detail-card {
  padding: 30px 24px;
  border-radius: 16px;
  margin-bottom: 40px;
  background-color: var(--primary-cream);
}

.result-detail-title {
  font-size: 24px;
  font-weight: 400;
  text-align: center;
  padding-top: 8px;
  margin-bottom: 16px;
  line-height: 1.4;
  color: var(--text-black);
}

.result-detail-divider {
  width: 48px;
  height: 4px;
  background-color: var(--primary-light-blue);
  border-radius: 4px;
  margin: 0 auto 24px auto;
}

.result-detail-subtitle {
  font-size: 18px;
  font-weight: 400;
  padding-top: 12px;
  margin-bottom: 12px;
  color: var(--text-black);
}

.result-feedback-box {
  border: 1px solid var(--primary-blue);
  border-radius: 12px;
  padding: 20px;
}

.result-feedback-label {
  font-size: 16px;
  color: var(--text-grey);
  margin-bottom: 8px;
  line-height: 1.4;
}

.result-feedback-text {
  font-size: 22px;
  font-weight: 380;
  color: var(--text-black);
}

/* Common Helpers */
.flex-center-link {
  text-decoration: none;
  display: flex;
  justify-content: center;
}

.text-black {
  color: var(--text-black);
}

/* Login Page Utilities */
.login-header-title {
  margin-top: 80px;
  margin-bottom: 20px;
  font-size: 48px;
  font-weight: 380;
  color: #333;
}

.login-divider {
  width: 240px;
  height: 3px;
  background-color: var(--primary-blue);
  margin: 0 auto 40px auto;
  border-radius: 2px;
}

.login-form-label {
  color: var(--text-black);
  font-size: 16px;
}

.mt-15 {
  margin-top: 15px;
}

.login-action-container {
  margin-top: 60px;
}

.login-btn {
  width: 55%;
  margin: 0 auto;
  display: block;
  font-size: 18px;
}

/* Custom Modal */
.custom-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.custom-modal-backdrop.show {
  opacity: 1;
  visibility: visible;
}

.custom-modal-content {
  background-color: var(--primary-cream);
  width: 85%;
  max-width: 320px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  transform: translateY(15px);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.custom-modal-backdrop.show .custom-modal-content {
  transform: translateY(0);
}

.custom-modal-body {
  padding: 40px 24px 28px 24px;
  font-size: 20px;
  font-weight: 380;
  color: var(--text-black);
  text-align: center;
  line-height: 1.5;
}

.custom-modal-footer {
  padding: 0 24px 32px 24px;
  display: flex;
  justify-content: center;
  border-top: none;
}

.custom-modal-close-btn {
  background-color: var(--primary-blue);
  color: white;
  border: none;
  border-radius: var(--border-radius-pill);
  font-family: 'Sarabun', sans-serif;
  font-size: 18px;
  font-weight: 380;
  cursor: pointer;
  width: 140px;
  height: 48px;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background-color 0.2s ease;
}

.custom-modal-close-btn:hover {
  background-color: #5c7499;
}

/* Agentic Workflow Highlighter */
.word-perfect {
  color: #44AC6F;
  /* Green */
  font-weight: 380;
}

.word-medium {
  color: #F6911C;
  /* Orange */
  font-weight: 380;
}

.word-poor {
  color: #EA2626;
  /* Red */
  font-weight: 380;
}