* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background: #f2f3f5;
    font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
    color: #222;
}

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

[hidden] {
    display: none !important;
}

.app-wrap {
    width: 100%;
    max-width: 430px;
    min-height: 100dvh;
    margin: 0 auto;
    background: #ffffff;
    position: relative;
    padding-bottom: 76px;
}

.app-header {
    padding: 32px 22px 18px;
}

.eyebrow {
    margin: 0 0 8px;
    font-size: 13px;
    color: #777;
    font-weight: 600;
}

.app-header h1 {
    margin: 0;
    font-size: 28px;
    letter-spacing: -0.5px;
}

.desc {
    margin: 10px 0 0;
    font-size: 14px;
    color: #777;
    line-height: 1.5;
}

.content {
    padding: 0 18px 24px;
}

.card {
    background: #ffffff;
    border: 1px solid #eeeeee;
    border-radius: 20px;
    padding: 18px;
    margin-bottom: 14px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
}

.card h2 {
    margin: 0 0 14px;
    font-size: 18px;
}

.quick-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.quick-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 56px;
    border-radius: 16px;
    background: #f5f5f5;
    font-size: 15px;
    font-weight: 700;
}

.quick-btn-wide {
    grid-column: 1 / -1;
}

.muted {
    color: #777;
    font-size: 14px;
    line-height: 1.5;
}

.bottom-nav {
    position: fixed;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 100%;
    max-width: 430px;
    height: 64px;
    background: #ffffff;
    border-top: 1px solid #eeeeee;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    z-index: 10;
}

.bottom-nav a {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #999;
    font-weight: 600;
}

.bottom-nav a.active {
    color: #111;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 7px;
    font-size: 14px;
    font-weight: 700;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid #dddddd;
    border-radius: 14px;
    background: #ffffff;
    font-family: inherit;
    font-size: 16px;
    line-height: 1.5;
    outline: none;
}

.form-group textarea {
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: #555555;
}

.primary-btn {
    width: 100%;
    min-height: 52px;
    border: 0;
    border-radius: 15px;
    background: #222222;
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}

.primary-btn:active {
    transform: scale(0.99);
}

/* items */
.summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
}

.summary-card {
    padding: 16px;
    border: 1px solid #eeeeee;
    border-radius: 18px;
    background: #ffffff;
}

.summary-label {
    display: block;
    margin-bottom: 8px;
    color: #777777;
    font-size: 13px;
}

.summary-card strong {
    font-size: 26px;
}

.section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.section-title-row h2 {
    margin: 0;
}

.text-btn {
    padding: 0;
    border: 0;
    background: transparent;
    color: #666666;
    font-size: 13px;
    cursor: pointer;
}

.item-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.list-item {
    padding: 15px;
    border: 1px solid #e8e8e8;
    border-radius: 16px;
    background: #fafafa;
}

.list-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.category-badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 9px;
    border-radius: 999px;
    background: #eeeeee;
    color: #555555;
    font-size: 12px;
    font-weight: 700;
}

.delete-btn {
    padding: 5px 8px;
    border: 0;
    background: transparent;
    color: #a94442;
    font-size: 12px;
    cursor: pointer;
}

.item-title {
    margin: 0 0 10px;
    font-size: 16px;
}

.item-main-text {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.item-sub-text {
    margin: 10px 0 0;
    color: #777777;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.question-box,
.answer-box {
    margin-top: 10px;
    padding: 12px;
    border-radius: 12px;
}

.question-box {
    background: #f0f0f0;
}

.answer-box {
    background: #ffffff;
    border: 1px solid #e6e6e6;
}

.field-label {
    display: block;
    margin-bottom: 6px;
    color: #777777;
    font-size: 11px;
    font-weight: 700;
}

.question-box p,
.answer-box p {
    margin: 0;
    font-size: 14px;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
}

.item-date {
    margin: 12px 0 0;
    color: #aaaaaa;
    font-size: 11px;
}

.empty-message {
    margin: 0;
    padding: 24px 10px;
    color: #999999;
    font-size: 14px;
    text-align: center;
}

/* app.css */
.form-group select {
    width: 100%;
    min-height: 48px;
    padding: 11px 38px 11px 13px;
    border: 1px solid #dddddd;
    border-radius: 14px;
    background: #ffffff;
    font-family: inherit;
    font-size: 16px;
    outline: none;
}

.form-group select:focus {
    border-color: #555555;
}

.shuffle-setting-card {
    padding-bottom: 15px;
}

.shuffle-setting-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.shuffle-option-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.switch-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #555555;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.switch-label input {
    width: 18px;
    height: 18px;
    margin: 0;
}

.outline-small-btn {
    min-height: 36px;
    padding: 7px 12px;
    border: 1px solid #dddddd;
    border-radius: 12px;
    background: #ffffff;
    color: #444444;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.outline-small-btn:active {
    background: #f5f5f5;
}

.shuffle-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px 10px;
    color: #888888;
    font-size: 13px;
}

.memory-card {
    min-height: 330px;
    padding: 24px 20px;
    border: 1px solid #e8e8e8;
    border-radius: 24px;
    background: #ffffff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: stretch;
    justify-content: center;
}

.shuffle-item-view {
    width: 100%;
    min-height: 280px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.shuffle-main-text {
    width: 100%;
    margin: 22px 0;
    color: #222222;
    font-size: 25px;
    font-weight: 750;
    line-height: 1.55;
    letter-spacing: -0.4px;
    text-align: center;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: keep-all;
}

.shuffle-memo-area {
    width: 100%;
    padding: 14px;
    border-radius: 15px;
    background: #f5f5f5;
    text-align: center;
}

.shuffle-memo-label {
    display: block;
    margin-bottom: 6px;
    color: #999999;
    font-size: 11px;
    font-weight: 700;
}

.shuffle-memo-text {
    margin: 0;
    color: #666666;
    font-size: 14px;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.shuffle-empty-state {
    width: 100%;
    min-height: 280px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.empty-title {
    margin: 0;
    color: #444444;
    font-size: 17px;
    font-weight: 700;
}

.empty-description {
    margin: 9px 0 18px;
    color: #999999;
    font-size: 13px;
    line-height: 1.5;
}

.primary-link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 14px;
    background: #222222;
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.play-status-text {
    min-height: 20px;
    margin: 13px 0 9px;
    color: #888888;
    font-size: 12px;
    text-align: center;
}

.shuffle-control-grid {
    display: grid;
    grid-template-columns: 1fr 1.35fr 1fr;
    gap: 9px;
}

.secondary-control-btn,
.primary-control-btn {
    min-height: 52px;
    border-radius: 15px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

.secondary-control-btn {
    border: 1px solid #dddddd;
    background: #ffffff;
    color: #444444;
}

.primary-control-btn {
    border: 1px solid #222222;
    background: #222222;
    color: #ffffff;
}

.secondary-control-btn:active,
.primary-control-btn:active {
    transform: scale(0.98);
}

.secondary-control-btn:disabled,
.primary-control-btn:disabled,
.outline-small-btn:disabled {
    cursor: default;
    opacity: 0.4;
}

@media (max-width: 360px) {
    .shuffle-setting-grid {
        grid-template-columns: 1fr;
    }
    .shuffle-main-text {
        font-size: 22px;
    }
}


/* dictation */
.dictation-setting-card {
    padding-bottom: 15px;
}

.dictation-setting-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.dictation-option-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.dictation-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px 10px;
    color: #888888;
    font-size: 13px;
}

.dictation-card {
    min-height: 420px;
    padding: 20px;
    border: 1px solid #e8e8e8;
    border-radius: 24px;
    background: #ffffff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.dictation-item-view {
    width: 100%;
}

.dictation-question-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 16px;
}

.dictation-title {
    color: #777777;
    font-size: 13px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dictation-question-box {
    padding: 18px;
    border-radius: 17px;
    background: #f3f3f3;
}

.dictation-field-label {
    display: block;
    margin-bottom: 7px;
    color: #888888;
    font-size: 11px;
    font-weight: 700;
}

.dictation-question-text {
    margin: 0;
    color: #222222;
    font-size: 19px;
    font-weight: 750;
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: keep-all;
}

.dictation-hint-box {
    margin-top: 12px;
    padding: 13px 15px;
    border: 1px dashed #d9d9d9;
    border-radius: 14px;
    background: #fafafa;
}

.dictation-hint-box p {
    margin: 0;
    color: #666666;
    font-size: 14px;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.dictation-answer-group {
    margin-top: 18px;
}

.dictation-answer-group textarea {
    min-height: 180px;
}

.dictation-result-section {
    margin-top: 15px;
}

.dictation-result-box {
    padding: 17px;
    border-radius: 17px;
    text-align: center;
}

.dictation-result-box.correct {
    border: 1px solid #bde1c7;
    background: #eef9f1;
}

.dictation-result-box.incorrect {
    border: 1px solid #edc2c2;
    background: #fff2f2;
}

.dictation-result-box.revealed {
    border: 1px solid #d9d9d9;
    background: #f7f7f7;
}

.dictation-result-title {
    margin: 0;
    color: #333333;
    font-size: 18px;
    font-weight: 800;
}

.dictation-result-description {
    margin: 7px 0 0;
    color: #777777;
    font-size: 13px;
    line-height: 1.5;
}

.dictation-answer-compare {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 12px 0;
}

.dictation-compare-box {
    padding: 15px;
    border: 1px solid #e7e7e7;
    border-radius: 15px;
    background: #fafafa;
}

.correct-answer-box {
    background: #ffffff;
}

.dictation-compare-text {
    margin: 0;
    color: #444444;
    font-size: 14px;
    line-height: 1.65;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.dictation-bottom-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
    margin-top: 12px;
}

.dictation-empty-state {
    min-height: 370px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

@media (max-width: 360px) {

    .dictation-setting-grid {
        grid-template-columns: 1fr;
    }

    .dictation-question-text {
        font-size: 17px;
    }

    .dictation-card {
        padding: 16px;
    }
}

/* mistakes */
.mistake-summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
}

.mistake-filter-card {
    padding-bottom: 15px;
}

.mistake-filter-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.mistake-filter-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.filtered-count-text {
    color: #777777;
    font-size: 13px;
}

.mistake-filter-buttons {
    display: flex;
    align-items: center;
    gap: 7px;
}

.danger-outline-btn {
    min-height: 36px;
    padding: 7px 12px;
    border: 1px solid #e2bcbc;
    border-radius: 12px;
    background: #ffffff;
    color: #a64747;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.danger-outline-btn:disabled {
    cursor: default;
    opacity: 0.4;
}

.mistake-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.mistake-item {
    padding: 17px;
    border: 1px solid #e7e7e7;
    border-radius: 20px;
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
}

.mistake-item.resolved {
    opacity: 0.72;
}

.mistake-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;

    margin-bottom: 14px;
}

.mistake-badge-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.mistake-status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
}

.mistake-status-badge.unresolved {
    background: #fff0f0;
    color: #a84b4b;
}

.mistake-status-badge.resolved {
    background: #edf7ef;
    color: #4e8059;
}

.delete-mistake-btn {
    padding: 5px 7px;
    border: 0;
    background: transparent;
    color: #a94442;
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
}

.mistake-item-title {
    margin: 0 0 12px;
    color: #333333;
    font-size: 17px;
    font-weight: 800;
}

.mistake-question-box,
.mistake-answer-box {
    padding: 14px;

    border-radius: 15px;
}

.mistake-question-box {
    margin-bottom: 10px;
    background: #f3f3f3;
}

.mistake-answer-box {
    margin-top: 9px;
}

.mistake-answer-box.user-answer {
    border: 1px solid #efd1d1;
    background: #fff6f6;
}

.mistake-answer-box.correct-answer {
    border: 1px solid #cce2d1;
    background: #f4faf5;
}

.mistake-field-label {
    display: block;
    margin-bottom: 7px;
    color: #888888;
    font-size: 11px;
    font-weight: 700;
}

.mistake-question-box p,
.mistake-answer-box p {
    margin: 0;
    color: #444444;
    font-size: 14px;
    line-height: 1.65;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.mistake-item-footer {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;

    margin-top: 14px;
}

.mistake-meta {
    display: flex;
    flex-direction: column;
    gap: 3px;
    color: #999999;
    font-size: 11px;
}

.toggle-resolved-btn {
    min-height: 36px;
    padding: 7px 12px;
    border: 1px solid #dddddd;
    border-radius: 12px;
    background: #ffffff;
    color: #444444;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.mistake-empty-state {
    min-height: 300px;
    padding: 30px 18px;
    border: 1px solid #e8e8e8;
    border-radius: 22px;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

@media (max-width: 420px) {

    .mistake-filter-grid {
        grid-template-columns: 1fr;
    }

    .mistake-filter-bottom {
        align-items: flex-start;
        flex-direction: column;
    }

    .mistake-filter-buttons {
        width: 100%;
    }

    .mistake-filter-buttons button {
        flex: 1;
    }

}

@media (max-width: 360px) {
    .mistake-item-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .toggle-resolved-btn {
        width: 100%;
    }
}

/* register csv */
.csv-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.csv-upload-box {
    padding: 15px;
    border: 1px solid #e7e7e7;
    border-radius: 16px;
    background: #fafafa;
}

.csv-upload-box h3 {
    margin: 0 0 12px;
    font-size: 15px;
}

.csv-upload-box input[type="file"] {
    width: 100%;
    margin: 12px 0;
    font-family: inherit;
    font-size: 13px;
}

/* items csv */
.backup-button-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

@media (max-width: 360px) {

    .backup-button-grid {
        grid-template-columns: 1fr;
    }
}


/* dictation help popover */
.grading-help-popover {
    position: fixed;
    top: calc(env(safe-area-inset-top) + 14px);
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 398px;
    padding: 15px;
    border: 1px solid #dddddd;
    border-radius: 16px;
    background: #ffffff;
    box-shadow:
        0 10px 35px rgba(0, 0, 0, 0.15);
    z-index: 9999;
}

.label-with-help{
	display: flex;
}

.grading-help-popover[hidden] {
    display: none !important;
}

.grading-help-item + .grading-help-item {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #eeeeee;
}

.grading-help-item strong {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
}

.grading-help-item p {
    margin: 0;
    color: #777777;
    font-size: 12px;
    line-height: 1.55;
}

.help-btn {
	padding-right: 3px;
	padding-left: 3px;
	margin-left: 3px;
	height: 18px;
}