#regularMemoryPage {
    min-height: 100vh;
    padding: 34px clamp(18px, 4vw, 64px) 70px;
    background:
        radial-gradient(circle at 92% 5%, rgba(116, 221, 182, 0.18), transparent 25%),
        linear-gradient(180deg, #f7fafc 0%, #ffffff 52%);
    color: #172033;
}

.regular-memory-page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    max-width: 1240px;
    margin: 0 auto 26px;
}

.regular-memory-page-header h1 {
    margin: 6px 0 8px;
    font-size: clamp(2rem, 4vw, 3.15rem);
    line-height: 1.12;
}

.regular-memory-page-header p:last-child {
    max-width: 700px;
    margin: 0;
    color: #657085;
}

.regular-memory-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: #008a65;
    font-weight: 800;
}

.regular-memory-header-actions {
    display: flex;
    gap: 10px;
    flex: 0 0 auto;
}

.regular-memory-shell {
    max-width: 1240px;
    margin: 0 auto;
}

.regular-memory-toolbar {
    display: grid;
    grid-template-columns: minmax(190px, 1fr) minmax(260px, 1.6fr) minmax(170px, .8fr) auto auto;
    align-items: end;
    gap: 14px;
    padding: 18px;
    border: 1px solid #e4e9f0;
    border-radius: 20px;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 15px 40px rgba(32, 46, 68, .07);
}

/* The shared .btn rule uses display:flex, so explicitly preserve the native
   hidden contract for actions that the catalog marks as read-only. */
.regular-memory-toolbar [hidden] {
    display: none !important;
}

.regular-memory-toolbar label {
    display: grid;
    gap: 7px;
    color: #5e687b;
    font-size: .82rem;
    font-weight: 800;
}

.regular-memory-toolbar select,
.regular-memory-search-box {
    min-height: 44px;
    border: 1px solid #dce3ec;
    border-radius: 12px;
    background: #f9fbfd;
}

.regular-memory-toolbar select {
    width: 100%;
    padding: 0 12px;
    color: #1d293c;
}

.regular-memory-search-box {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0 13px;
}

.regular-memory-search-box i { color: #929cac; }
.regular-memory-search-box input {
    min-width: 0;
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
}

.regular-memory-tabs {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 22px 2px 12px;
    scrollbar-width: thin;
}

.regular-memory-tabs button {
    flex: 0 0 auto;
    padding: 11px 16px;
    border: 1px solid #dce3ec;
    border-radius: 999px;
    background: #fff;
    color: #4c576b;
    font-weight: 800;
    cursor: pointer;
    transition: .2s ease;
}

.regular-memory-tabs button:hover,
.regular-memory-tabs button.active {
    border-color: #00a77b;
    color: #007d5c;
    background: #ebfff8;
    transform: translateY(-1px);
}

.regular-memory-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin: 12px 0 18px;
}

.regular-memory-summary article {
    display: grid;
    gap: 4px;
    padding: 15px 17px;
    border: 1px solid #e5e9f0;
    border-radius: 15px;
    background: rgba(255, 255, 255, .86);
}

.regular-memory-summary span { color: #778195; font-size: .78rem; }
.regular-memory-summary strong { font-size: 1.12rem; }

.regular-memory-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    min-height: 270px;
}

.regular-memory-card {
    position: relative;
    display: grid;
    gap: 15px;
    min-width: 0;
    padding: 20px;
    text-align: left;
    color: #192438;
    border: 1px solid #e0e6ee;
    border-top: 4px solid #00a77b;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(31, 45, 66, .07);
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease;
}

.regular-memory-card:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 18px 38px rgba(31, 45, 66, .12);
}

.regular-memory-card:disabled { cursor: default; opacity: .92; }
.regular-memory-card--morphology { border-top-color: #ff5365; }
.regular-memory-card--compound { border-top-color: #3685ff; }
.regular-memory-card--familiar { border-top-color: #7657ff; }
.regular-memory-card--scene { border-top-color: #ff9d16; }
.regular-memory-card--confusion,
.regular-memory-card--semantic { border-top-color: #c054e8; }
.regular-memory-card--ordinary { border-top-color: #7b8799; }

.regular-memory-card-top,
.regular-memory-card-metrics {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.regular-memory-type,
.regular-memory-confidence {
    padding: 5px 9px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #5d687b;
    font-size: .72rem;
    font-weight: 900;
}

.regular-memory-confidence { color: #007e5d; background: #e9fff7; }
.regular-memory-card h3 { margin: 0; font-size: 1.25rem; overflow-wrap: anywhere; }
.regular-memory-card-metrics { align-items: flex-start; color: #768196; font-size: .72rem; }
.regular-memory-card-metrics span { display: grid; gap: 3px; }
.regular-memory-card-metrics b { color: #2b3649; font-size: .92rem; }
.regular-memory-card-metrics .regular-memory-today { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 999px; color: #687386; background: #eef1f5; font-weight: 800; }
.regular-memory-card-metrics .regular-memory-today.is-scheduled { color: #007a59; background: #dcf8ed; }
.regular-memory-progress { height: 6px; overflow: hidden; border-radius: 999px; background: #edf1f5; }
.regular-memory-progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #00a77b, #2fd4a7); }
.regular-memory-card small { color: #7b8597; }

.regular-memory-state {
    grid-column: 1 / -1;
    align-self: center;
    justify-self: stretch;
    display: grid;
    justify-items: center;
    gap: 9px;
    padding: 54px 20px;
    color: #788397;
    text-align: center;
    border: 1px dashed #d8e0e9;
    border-radius: 18px;
    background: rgba(255, 255, 255, .72);
}

.regular-memory-state i { font-size: 1.7rem; color: #00a77b; }
.regular-memory-state strong { color: #334055; font-size: 1.08rem; }
.regular-memory-state p { margin: 0; }
.regular-memory-state--error i { color: #de5461; }

.regular-memory-organize-error {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    margin: 0 0 16px;
    color: #7e351f;
    background: #fff4ec;
    border: 1px solid #f4b897;
    border-radius: 14px;
}
.regular-memory-organize-error p { margin: 4px 0 0; color: #92533e; }

.study-regularity-preview {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-top: 12px;
}
.study-regularity-preview[hidden] { display: none !important; }
.study-regularity-preview > span { padding: 9px 10px; border: 1px solid #cfeae1; border-radius: 10px; background: #f4fffb; text-align: center; }
.study-regularity-preview__loading,
.study-regularity-preview__error { grid-column: 1 / -1; }

.regular-memory-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding-top: 24px;
}

.regular-memory-pagination span { color: #667187; font-weight: 800; }

.regular-memory-drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1040;
    background: rgba(16, 25, 40, .38);
    opacity: 0;
    transition: opacity .22s ease;
}

.regular-memory-drawer-backdrop.open { opacity: 1; }

.regular-memory-drawer {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 1050;
    width: min(560px, 94vw);
    height: 100vh;
    overflow-y: auto;
    padding: 24px;
    background: #fff;
    box-shadow: -20px 0 50px rgba(20, 31, 48, .18);
    transform: translateX(105%);
    transition: transform .24s ease;
}

.regular-memory-drawer.open { transform: translateX(0); }
.regular-memory-drawer-header { display: flex; justify-content: space-between; gap: 20px; padding-bottom: 17px; border-bottom: 1px solid #e5e9f0; }
.regular-memory-drawer-header small { color: #008a65; font-weight: 900; }
.regular-memory-drawer-header h2 { margin: 4px 0 0; }
.regular-memory-drawer-close { width: 40px; height: 40px; border: 0; border-radius: 50%; background: #f2f5f8; color: #586377; cursor: pointer; }
.regular-memory-detail-content { padding-top: 18px; }
.regular-memory-detail-note { display: grid; gap: 7px; padding: 16px; border-radius: 15px; background: #effbf7; }
.regular-memory-detail-note span { color: #00825f; font-size: .76rem; font-weight: 900; }
.regular-memory-detail-note p { margin: 0; color: #667187; }
.regular-memory-word-list { display: grid; gap: 10px; margin-top: 16px; }
.regular-memory-word-list article { padding: 15px; border: 1px solid #e5e9f0; border-radius: 14px; }
.regular-memory-word-list article > div { display: flex; justify-content: space-between; gap: 16px; }
.regular-memory-word-list article span { color: #738095; }
.regular-memory-word-list article small { display: block; margin-top: 5px; color: #00a77b; }
.regular-memory-word-list article p { margin: 10px 0 0; padding-top: 10px; border-top: 1px dashed #e1e6ec; color: #586377; }
.regular-memory-word-list article p b { display: block; color: #253247; }
.regular-memory-muted { color: #7b8597; text-align: center; }

.regular-memory-editor-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 14px 0;
}

.regular-memory-word-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.regular-memory-word-actions button { padding: 5px 8px; border: 1px solid #dce5e1; border-radius: 8px; background: #fff; color: #29705c; font-size: .72rem; font-weight: 800; cursor: pointer; }

.regular-memory-methods { display: grid; gap: 8px; margin-top: 12px; }
.regular-memory-method {
    display: grid;
    gap: 5px;
    padding: 12px;
    border: 1px solid #e4e9f0;
    border-radius: 12px;
    background: #f9fbfd;
}
.regular-memory-method.is-primary { border-color: #9ee4ce; background: #f0fff9; }
.regular-memory-method > span { color: #008361; font-size: .7rem; font-weight: 900; }
.regular-memory-method p { margin: 0; color: #566176; }
.regular-memory-method small { color: #b35b00; }
.regular-memory-method-empty { color: #7b8597; font-size: .84rem; }

.regular-memory-media-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.regular-memory-media-grid figure { position: relative; overflow: hidden; margin: 0; border: 1px solid #e3e8ee; border-radius: 13px; background: #f4f6f8; }
.regular-memory-media-grid img,
.regular-memory-media-grid video { display: block; width: 100%; max-height: 260px; object-fit: cover; background: #111827; }
.regular-memory-media-grid figcaption { padding: 8px 10px; color: #667187; font-size: .76rem; }
.regular-memory-media-fallback { display: none; min-height: 110px; place-items: center; padding: 16px; color: #7a8496; text-align: center; }
.regular-memory-media-grid figure.is-error img,
.regular-memory-media-grid figure.is-error video { display: none; }
.regular-memory-media-grid figure.is-error .regular-memory-media-fallback { display: grid; }

#regularMemoryEditorModal { z-index: 1200; }
.regular-memory-editor-modal { max-width: 760px; }
.regular-memory-editor-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.regular-memory-editor-form label { display: grid; gap: 6px; color: #566176; font-size: .82rem; font-weight: 800; }
.regular-memory-editor-form input,
.regular-memory-editor-form select,
.regular-memory-editor-form textarea { width: 100%; padding: 10px 12px; border: 1px solid #dce3ec; border-radius: 10px; background: #fbfcfe; }
.regular-memory-editor-wide,
.regular-memory-editor-help,
.regular-memory-editor-actions { grid-column: 1 / -1; }
.regular-memory-editor-help { margin: 0; padding: 10px 12px; border-radius: 10px; color: #6b5b15; background: #fff9df; font-size: .78rem; }
.regular-memory-editor-actions { display: flex; justify-content: flex-end; gap: 10px; }

.word-detail-memory-method { display: none; gap: 6px; padding: 13px; border: 1px solid #dce8e3; border-radius: 12px; background: #f3fff9; }
.word-detail-memory-method.active { display: grid; }
.word-detail-memory-method > span,
.word-card-memory-method > span { color: #00825f; font-size: .72rem; font-weight: 900; }
.word-detail-memory-method p,
.word-card-memory-method p { margin: 0; color: #576276; }
.word-detail-memory-method small,
.word-card-memory-method small { color: #ae5c09; }
.word-detail-memory-switch { margin-top: 9px; }
.word-detail-memory-media,
.word-card-memory-media { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 10px; }
.word-detail-memory-media figure,
.word-card-memory-media figure { overflow: hidden; margin: 0; border: 1px solid #e2e7ed; border-radius: 11px; background: #f5f7f9; }
.word-detail-memory-media img,
.word-detail-memory-media video,
.word-card-memory-media img,
.word-card-memory-media video { display: block; width: 100%; max-height: 210px; object-fit: cover; }
.word-detail-memory-media figcaption,
.word-card-memory-media figcaption { padding: 7px 9px; color: #677286; font-size: .72rem; }

.word-card-memory-panel { display: grid; gap: 8px; margin-top: 14px; padding: 13px; border: 1px solid #dce8e3; border-radius: 13px; background: #f7fffb; text-align: left; }
.word-card-memory-heading { color: #007f5d; font-size: .78rem; font-weight: 900; }
.word-card-memory-method { display: none; gap: 5px; }
.word-card-memory-method.active { display: grid; }
.word-card-memory-switch { justify-self: start; padding: 6px 10px; border: 1px solid #a8decf; border-radius: 999px; background: #fff; color: #007e5c; font-weight: 800; cursor: pointer; }
.word-card-memory-empty { margin: 0; color: #788397; font-size: .8rem; }

@media (max-width: 1400px) {
    .regular-memory-toolbar { grid-template-columns: 1fr 1fr; }
    .regular-memory-search-wrap { grid-column: 1 / -1; grid-row: 1; }
    .regular-memory-toolbar > .btn { width: 100%; min-width: 0; }
}

@media (max-width: 980px) {
    .regular-memory-summary { grid-template-columns: 1fr 1fr; }
    .regular-memory-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
    #regularMemoryPage { padding: 22px 14px 54px; }
    .regular-memory-page-header { align-items: stretch; flex-direction: column; }
    .regular-memory-header-actions { display: grid; grid-template-columns: 1fr; }
    .regular-memory-toolbar { grid-template-columns: 1fr; }
    .regular-memory-search-wrap { grid-column: auto; grid-row: auto; }
    .regular-memory-summary { grid-template-columns: 1fr 1fr; }
    .regular-memory-grid { grid-template-columns: 1fr; }
    .regular-memory-card-metrics { gap: 4px; }
    .regular-memory-drawer { width: 100vw; padding: 19px 15px; }
    .regular-memory-media-grid,
    .regular-memory-editor-form,
    .word-detail-memory-media,
    .word-card-memory-media { grid-template-columns: 1fr; }
    .regular-memory-editor-wide,
    .regular-memory-editor-help,
    .regular-memory-editor-actions { grid-column: auto; }
    .regular-memory-organize-error { align-items: stretch; flex-direction: column; }
    .study-regularity-preview { grid-template-columns: 1fr 1fr; }
}
