
#rlpsa1-app, #rlpsa1-app * {
  box-sizing: border-box;
}

#rlpsa1-app {
  --rl-green: #2f9e44;
  --rl-dark-green: #087f23;
  --rl-blue: #087ee2;
  --rl-orange: #ff8a00;
  --rl-red: #ef3b4f;
  --rl-purple: #7950f2;
  --rl-teal: #0ca678;
  --rl-dark: #10243e;
  --rl-light: #f4fbff;
  font-family: Arial, "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  color: #172033;
  max-width: 1280px;
  margin: 20px auto;
  background: linear-gradient(135deg, #e8f7ff, #fff8e7, #ecffe9);
  border-radius: 24px;
  padding: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.12);
}

.rlpsa1-loading {
  padding: 30px;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
}

.rlpsa1-header {
  display: grid;
  grid-template-columns: 230px 1fr 360px 170px;
  gap: 12px;
  align-items: center;
  background: linear-gradient(90deg, #138a36, #52b665);
  color: #fff;
  border-radius: 18px;
  padding: 10px 14px;
  box-shadow: 0 4px 0 rgba(0,0,0,.16);
}

.rlpsa1-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,.95);
  color: var(--rl-dark);
  border-radius: 14px;
  padding: 8px 10px;
}

.rlpsa1-logo-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, #2f9e44, #087ee2);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 28px;
  font-weight: 900;
}

.rlpsa1-brand-title {
  font-weight: 900;
  font-size: 18px;
  line-height: 1.1;
}

.rlpsa1-brand-sub {
  font-size: 13px;
  color: #087f23;
  font-weight: 800;
}

.rlpsa1-lesson-title {
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 900;
  line-height: 1.05;
  text-shadow: 0 2px 0 rgba(0,0,0,.2);
}

.rlpsa1-lesson-pill {
  background: #087f23;
  border-radius: 16px;
  padding: 10px 18px;
  font-size: 18px;
  font-weight: 900;
  text-align: center;
}

.rlpsa1-progress-box {
  background: rgba(255,255,255,.95);
  color: #111827;
  border: 2px solid #087f23;
  border-radius: 12px;
  padding: 9px 12px;
}

.rlpsa1-progress-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-weight: 800;
  margin-bottom: 5px;
}

.rlpsa1-progress-track {
  height: 14px;
  border: 1px solid #9ad2a5;
  background: #e6f5e8;
  border-radius: 999px;
  overflow: hidden;
}

.rlpsa1-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #087f23, #51cf66);
  width: 10%;
  border-radius: 999px;
}

.rlpsa1-score {
  display: flex;
  gap: 8px;
}

.rlpsa1-score-box {
  flex: 1;
  background: rgba(255,255,255,.95);
  color: #111827;
  border-radius: 12px;
  padding: 10px;
  text-align: center;
  font-size: 20px;
  font-weight: 900;
}

.rlpsa1-main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}

.rlpsa1-photo-card {
  background: white;
  border-radius: 18px;
  overflow: hidden;
  border: 2px solid rgba(0,0,0,.08);
  box-shadow: 0 6px 18px rgba(0,0,0,.11);
}

.rlpsa1-photo {
  width: 100%;
  min-height: 470px;
  height: 58vh;
  max-height: 650px;
  object-fit: cover;
  display: block;
  background: #ddeaf0;
}

.rlpsa1-photo-caption {
  padding: 14px 16px;
  font-size: 18px;
  font-weight: 800;
  background: #fff;
}

.rlpsa1-panel {
  background: rgba(255,255,255,.96);
  border-radius: 18px;
  border: 1px solid rgba(0,0,0,.08);
  margin-bottom: 12px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
}

.rlpsa1-panel-title {
  padding: 12px 16px;
  color: #fff;
  font-size: 24px;
  font-weight: 900;
  display: flex;
  gap: 10px;
  align-items: center;
}

.rlpsa1-purple { background: linear-gradient(90deg, #7048e8, #9775fa); }
.rlpsa1-blue { background: linear-gradient(90deg, #087ee2, #4dabf7); }
.rlpsa1-green { background: linear-gradient(90deg, #2f9e44, #69db7c); }
.rlpsa1-orange { background: linear-gradient(90deg, #ff7a00, #ffa94d); }
.rlpsa1-pink { background: linear-gradient(90deg, #e64980, #ff87ad); }
.rlpsa1-teal { background: linear-gradient(90deg, #0ca678, #38d9a9); }

.rlpsa1-panel-body {
  padding: 14px 16px;
}

.rlpsa1-vocab-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.rlpsa1-vocab-card {
  border: 1px solid #d0c9e8;
  border-radius: 14px;
  padding: 10px 8px;
  text-align: center;
  background: linear-gradient(180deg, #fff, #fafaff);
}

.rlpsa1-vocab-icon {
  font-size: 42px;
  line-height: 1.1;
  margin-bottom: 4px;
}

.rlpsa1-word {
  font-weight: 900;
  font-size: 18px;
}

.rlpsa1-jp {
  font-weight: 800;
  color: #333;
  margin-top: 2px;
}

.rlpsa1-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.rlpsa1-question {
  font-size: 18px;
  line-height: 1.5;
  border-right: 2px dashed rgba(0,0,0,.18);
  padding-right: 12px;
}

.rlpsa1-answer {
  font-size: 18px;
  line-height: 1.5;
  font-weight: 700;
}

.rlpsa1-model-list {
  margin: 0;
  padding-left: 24px;
  font-size: 18px;
  line-height: 1.45;
}

.rlpsa1-model-list li {
  margin: 6px 0;
}

.rlpsa1-model-list strong {
  color: #111827;
}

.rlpsa1-practice-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  text-align: center;
}

.rlpsa1-practice-choice {
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 16px;
  padding: 16px;
  background: #fff8fb;
}

.rlpsa1-face {
  font-size: 58px;
}

.rlpsa1-controls {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 10px;
  position: sticky;
  bottom: 10px;
  z-index: 5;
  background: rgba(224, 246, 250, .92);
  backdrop-filter: blur(6px);
  border-radius: 18px;
  padding: 10px;
}

.rlpsa1-btn {
  border: none;
  border-radius: 14px;
  color: #fff;
  font-weight: 900;
  font-size: 15px;
  line-height: 1.1;
  padding: 12px 8px;
  min-height: 64px;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0,0,0,.22);
  transition: .08s transform, .08s box-shadow, .15s filter;
}

.rlpsa1-btn:hover {
  filter: brightness(1.05);
}

.rlpsa1-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(0,0,0,.25);
}

.rlpsa1-btn span {
  display: block;
  font-size: 26px;
  margin-bottom: 3px;
}

.rlpsa1-btn small {
  display: block;
  font-size: 12px;
  margin-top: 3px;
  opacity: .95;
}

.rlpsa1-home { background: #1971c2; }
.rlpsa1-list { background: #0ca678; }
.rlpsa1-prev { background: #f08c00; }
.rlpsa1-next { background: #1c7ed6; }
.rlpsa1-reset { background: #e03131; }
.rlpsa1-flash { background: #099268; }
.rlpsa1-quiz { background: #7048e8; }
.rlpsa1-read { background: #2b8a3e; }

.rlpsa1-view {
  display: none;
}

.rlpsa1-view.active {
  display: block;
}

.rlpsa1-lesson-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.rlpsa1-lesson-list-btn {
  border: 2px solid #cde6d1;
  background: #fff;
  border-radius: 16px;
  padding: 14px;
  cursor: pointer;
  text-align: left;
  font-size: 18px;
  font-weight: 900;
}

.rlpsa1-lesson-list-btn:hover {
  background: #f1fff3;
}

.rlpsa1-flashcard {
  min-height: 270px;
  display: grid;
  place-items: center;
  text-align: center;
  background: linear-gradient(135deg, #fff, #eff6ff);
  border: 3px dashed #087ee2;
  border-radius: 20px;
  cursor: pointer;
  padding: 20px;
}

.rlpsa1-flash-main {
  font-size: clamp(44px, 9vw, 80px);
  font-weight: 900;
  color: var(--rl-dark);
}

.rlpsa1-flash-sub {
  font-size: clamp(24px, 5vw, 42px);
  font-weight: 900;
  color: #2f9e44;
}

.rlpsa1-quiz-choice {
  display: block;
  width: 100%;
  background: #fff;
  border: 2px solid #bcd2ff;
  border-radius: 14px;
  padding: 14px;
  margin: 8px 0;
  font-size: 18px;
  text-align: left;
  cursor: pointer;
  color: #111827;
}

.rlpsa1-quiz-choice.correct {
  background: #d3f9d8;
  border-color: #2f9e44;
}

.rlpsa1-quiz-choice.wrong {
  background: #ffe3e3;
  border-color: #e03131;
}

.rlpsa1-feedback {
  font-size: 20px;
  font-weight: 900;
  margin-top: 12px;
}

.rlpsa1-speech-box {
  margin-top: 10px;
  background: #f1f8ff;
  border-left: 6px solid #087ee2;
  padding: 10px;
  border-radius: 10px;
  font-weight: 800;
}

@media (max-width: 1050px) {
  .rlpsa1-header {
    grid-template-columns: 1fr;
  }
  .rlpsa1-main {
    grid-template-columns: 1fr;
  }
  .rlpsa1-photo {
    height: auto;
    min-height: 0;
  }
  .rlpsa1-controls {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 650px) {
  #rlpsa1-app {
    margin: 8px auto;
    padding: 8px;
    border-radius: 16px;
  }
  .rlpsa1-vocab-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .rlpsa1-two-col, .rlpsa1-practice-row {
    grid-template-columns: 1fr;
  }
  .rlpsa1-question {
    border-right: 0;
    border-bottom: 2px dashed rgba(0,0,0,.18);
    padding-right: 0;
    padding-bottom: 8px;
  }
  .rlpsa1-controls {
    grid-template-columns: repeat(2, 1fr);
    position: static;
  }
  .rlpsa1-lesson-list {
    grid-template-columns: 1fr;
  }
}
