:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
  color: #203d38;
  background: #f4f5ef;
  line-height: 1.65;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
.app { width: min(100% - 40px, 760px); margin: 0 auto; padding: 46px 0 30px; }
.eyebrow { color: #52766a; font-size: .85rem; letter-spacing: .08em; margin: 0 0 8px; }
h1 { font-size: clamp(1.65rem, 5vw, 2.4rem); letter-spacing: -.04em; line-height: 1.3; margin: 0; }
.intro { color: #5b7068; margin: 14px 0 28px; }
.import-panel { background: #e8ede4; border-radius: 16px; padding: 20px; }
.file-label { font-weight: 650; }
.help { font-size: .88rem; color: #5b7068; margin: 7px 0; }
input[type="file"] { display: block; width: 100%; margin-top: 12px; font: inherit; font-size: .9rem; }
input::file-selector-button { padding: 10px 14px; margin-right: 12px; border: 1px solid #becdc4; border-radius: 8px; background: white; color: #203d38; cursor: pointer; }
.message { min-height: 1.6em; font-size: .9rem; margin: 10px 2px 20px; }
.message.error, .storage-note .error { color: #a13e2c; }
.empty-state { text-align: center; padding: 35px 20px 55px; color: #5b7068; }
.empty-number { display: inline-block; background: #fff; border: 1px solid #d9e1d8; border-radius: 20px; padding: 20px 28px; font-size: 1.8rem; color: #52766a; }
.empty-state h2 { font-size: 1.2rem; color: #203d38; margin-top: 22px; }
.topic-header { margin: 0 4px 18px; }
.badge { display: inline-block; font-size: .8rem; background: #dfe9e2; color: #305848; border-radius: 6px; padding: 3px 9px; }
.topic-header h2 { font-size: 1.25rem; line-height: 1.45; margin: 8px 0 2px; overflow-wrap: anywhere; }
.topic-header p { margin: 0; font-size: .92rem; color: #5b7068; }
.practice-card { background: #fffef9; border: 1px solid #e0e5dc; border-radius: 24px; padding: 30px; box-shadow: 0 10px 30px #233b3010; }
.card-heading { display: flex; justify-content: space-between; gap: 16px; color: #5b7068; font-size: .85rem; }
.chinese-text { font-size: clamp(1.2rem, 3.8vw, 1.5rem); line-height: 1.8; margin: 22px 0 28px; }
.chinese-text, .english-text, .ipa-text { white-space: pre-wrap; overflow-wrap: anywhere; }
button { min-height: 46px; border: 1px solid #bfcfc4; border-radius: 10px; background: transparent; color: #294a3e; font: inherit; font-size: .95rem; padding: 10px 17px; cursor: pointer; }
button:hover:not(:disabled) { background: #eaf1e9; }
button:focus-visible, input:focus-visible { outline: 3px solid #bb8b3d; outline-offset: 4px; }
button:disabled { opacity: .4; cursor: default; }
button.primary { background: #305e4b; color: white; border-color: #305e4b; }
button.primary:hover { background: #244b3a; }
.reveal-controls { display: flex; flex-wrap: wrap; gap: 10px; }
.answer-panel { margin-top: 22px; padding: 18px 20px; background: #f0f4ed; border-radius: 12px; }
.section-label { color: #5b7068; font-size: .8rem; margin: 0 0 8px; }
.english-text { font-size: 1.2rem; line-height: 1.7; margin: 0; }
.ipa-panel { background: #f4f0e7; }
.ipa-text { font-family: "Arial", "DejaVu Sans", sans-serif; font-size: 1.05rem; line-height: 1.9; margin: 0; }
.mark-panel { border: 0; padding: 0; margin: 28px 0 0; min-width: 0; }
.mark-panel legend { font-size: .9rem; padding: 0; margin-bottom: 12px; }
.mark-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mark-buttons button { padding: 10px 4px; }
.mark-buttons button[aria-pressed="true"] { background: #305e4b; color: white; border-color: #305e4b; }
.navigation { display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid #e2e7de; margin-top: 20px; padding-top: 20px; }
.storage-note { font-size: .8rem; color: #64746c; margin: 24px 4px 0; }
#save-message { font-weight: 600; }
.cloud-panel { background: #fffef9; border: 1px solid #d9e1d8; border-radius: 16px; padding: 20px; margin-bottom: 24px; }
.cloud-panel h2 { font-size: 1.15rem; margin: 0 0 8px; }
#cloud-login-form { display: grid; gap: 8px; margin-top: 16px; }
#cloud-login-form label { font-size: .9rem; }
#cloud-login-form input { min-width: 0; width: 100%; min-height: 46px; border: 1px solid #bfcfc4; border-radius: 8px; padding: 10px; font: inherit; font-size: 16px; background: #fff; }
#cloud-login { justify-self: start; margin-top: 6px; }
#cloud-account { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.cloud-topics { list-style: none; padding: 0; margin: 0; overflow-wrap: anywhere; }
.cloud-topics li { border-top: 1px solid #d9e1d8; padding: 12px 0; }
.cloud-topics li p { margin: 4px 0 0; color: #5b7068; }
.cloud-topic-button { display: block; width: 100%; text-align: left; overflow-wrap: anywhere; }
.cloud-topic-button strong, .cloud-topic-button span { display: block; }
.cloud-topic-button span { margin-top: 4px; font-size: .9rem; }
.cloud-topic-button[aria-pressed="true"] { border-color: #305e4b; background: #e8ede4; }
.source-panel { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.source-panel .help { flex: 1; min-width: 180px; }
.upload-preview { flex-basis: 100%; min-width: 0; padding: 16px; border: 1px solid #bfcfc4; border-radius: 12px; background: #f0f4ed; }
.upload-preview h3 { margin: 0 0 10px; font-size: 1rem; }
#upload-summary { white-space: pre-wrap; overflow-wrap: anywhere; }
.upload-preview button { margin: 6px 6px 0 0; }
@media (max-width: 480px) {
  .app { width: calc(100% - 28px); padding-top: 28px; }
  .practice-card { padding: 22px 18px; border-radius: 18px; }
  .import-panel { padding: 16px; }
  .answer-panel { padding: 15px; }
  .navigation button { flex: 1; padding: 10px 8px; }
}
