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

/* ---- VARIABLES ---- */
:root {
  --orange: #E8632A;
  --yellow: #F5A623;
  --cream: #FFF8EF;
  --dark: #1A1008;
  --mid: #6B4C2A;
  --light: #F5E6D3;
  --card-w: min(92vw, 480px);
}

/* ---- RESET ---- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Sarabun', sans-serif;
  background: var(--cream);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 0 60px;
  overflow-x: hidden;
}

/* ---- HEADER ---- */
.header {
  width: 100%;
  background: var(--dark);
  padding: 20px 24px 18px;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.header-tag {
  display: inline-block;
  background: var(--orange);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 3px 12px;
  border-radius: 20px;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.header h1 {
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.3;
}

.header h1 span {
  color: var(--yellow);
}

.header p {
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  margin-top: 4px;
}

/* ---- PROGRESS ---- */
.progress-wrap {
  width: var(--card-w);
  margin: 20px auto 4px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.progress-bar-bg {
  flex: 1;
  height: 6px;
  background: #E8D8C8;
  border-radius: 10px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--orange), var(--yellow));
  border-radius: 10px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-text {
  font-size: 13px;
  font-weight: 700;
  color: var(--mid);
  min-width: 48px;
  text-align: right;
}

/* ---- SECTION SEPARATOR ---- */
.section-sep {
  width: var(--card-w);
  margin: 24px auto 4px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-sep-line {
  flex: 1;
  height: 1px;
  background: #E0C8B0;
}

.section-sep-badge {
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

/* ---- CARD ---- */
.card {
  width: var(--card-w);
  background: #fff;
  border-radius: 20px;
  padding: 28px 26px 22px;
  box-shadow: 0 8px 40px rgba(100, 50, 10, 0.13);
  border-left: 6px solid var(--orange);
  position: relative;
  transition: transform 0.18s, box-shadow 0.18s;
  cursor: pointer;
  margin-bottom: 12px;
}

.card:active {
  transform: scale(0.98);
}

.card.done {
  border-left-color: #4CAF50;
  opacity: 0.6;
}

.card.skipped {
  border-left-color: #B0BEC5;
  opacity: 0.5;
}

/* ---- QUESTION NUMBER BADGE ---- */
.q-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--orange);
  color: #fff;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0;
  margin-bottom: 12px;
}

/* ---- QUESTION TEXT ---- */
.q-text {
  font-size: 19px;
  font-weight: 600;
  color: var(--dark);
  line-height: 1.55;
  margin-bottom: 14px;
}

/* ---- HINT ---- */
.q-hint {
  font-size: 13px;
  color: #A08060;
  line-height: 1.5;
  background: #FFF3E0;
  border-radius: 10px;
  padding: 10px 14px;
  border-left: 3px solid var(--yellow);
}

.q-hint::before {
  content: '💡 ';
}

/* ---- CARD ACTIONS ---- */
.card-actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

.btn {
  flex: 1;
  padding: 10px 0;
  border-radius: 12px;
  border: none;
  font-family: 'Sarabun', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.btn:active {
  transform: scale(0.96);
}

.btn-done {
  background: #E8F5E9;
  color: #2E7D32;
}

.btn-done.active,
.btn-done:hover {
  background: #4CAF50;
  color: #fff;
}

.btn-skip {
  background: #ECEFF1;
  color: #607D8B;
  flex: 0.6;
}

.btn-skip:hover {
  background: #B0BEC5;
  color: #fff;
}

.btn-note {
  background: #FFF8E1;
  color: #F57F17;
  flex: 0.6;
}

.btn-note.active {
  background: var(--yellow);
  color: #fff;
}

/* ---- NOTE TEXTAREA ---- */
.note-area {
  width: 100%;
  margin-top: 12px;
  padding: 12px 14px;
  border: 2px solid var(--yellow);
  border-radius: 12px;
  font-family: 'Sarabun', sans-serif;
  font-size: 15px;
  color: var(--dark);
  background: #FFFDF5;
  resize: none;
  min-height: 80px;
  outline: none;
  transition: border-color 0.2s;
  display: none;
}

.note-area:focus {
  border-color: var(--orange);
}

.note-area.show {
  display: block;
}

/* ---- FLOATING ACTION BUTTON ---- */
.fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 28px;
  background: var(--dark);
  color: #fff;
  border: none;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  transition: transform 0.2s;
}

.fab:active {
  transform: scale(0.92);
}

/* ---- MODAL ---- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 300;
  align-items: flex-end;
  justify-content: center;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  width: 100%;
  max-width: 520px;
  background: #fff;
  border-radius: 24px 24px 0 0;
  padding: 24px 20px 40px;
  max-height: 80vh;
  overflow-y: auto;
  animation: slideUp 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.modal-handle {
  width: 40px;
  height: 4px;
  background: #DDD;
  border-radius: 4px;
  margin: 0 auto 16px;
}

.modal h2 {
  font-size: 18px;
  font-weight: 800;
  color: var(--dark);
  margin-bottom: 16px;
}

/* ---- SUMMARY ROWS (inside modal) ---- */
.summary-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #F0E8DC;
}

.summary-row:last-child {
  border-bottom: none;
}

.sum-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.sum-q {
  font-size: 14px;
  color: var(--dark);
  flex: 1;
  line-height: 1.45;
}

.sum-status {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.sum-note {
  font-size: 12px;
  color: var(--mid);
  margin-top: 4px;
  font-style: italic;
}

.modal-close {
  width: 100%;
  margin-top: 16px;
  padding: 14px;
  background: var(--dark);
  color: #fff;
  border: none;
  border-radius: 14px;
  font-family: 'Sarabun', sans-serif;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

/* ---- RESET BUTTON ---- */
.reset-wrap {
  width: var(--card-w);
  margin: 20px auto 0;
  text-align: center;
}

.btn-reset {
  background: none;
  border: 2px solid #E0C8B0;
  color: var(--mid);
  font-family: 'Sarabun', sans-serif;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 20px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-reset:hover {
  border-color: var(--orange);
  color: var(--orange);
}
