body {
    font-family: Arial, sans-serif;
    background: #f7f8fa;
    color: #222;
    margin: 0;
    padding: 0;
}
/* Use border-box so padding is included in width calculations */
*, *::before, *::after {
    box-sizing: border-box;
}
header {
    background: linear-gradient(90deg, #a7c7e7 0%, #f7c6d9 100%);
    padding: 20px 0;
    text-align: center;
}
header h1 {
    color: #3a4a6b;
    margin: 0 0 10px 0;
}
nav a {
    color: #e75480;
    text-decoration: none;
    margin: 0 10px;
    font-weight: bold;
}
nav a:hover {
    color: #3a4a6b;
}
main {
    max-width: 600px;
    margin: 30px auto;
    padding: 30px;
}

@media (max-width: 640px) {
    main {
        margin: 16px;
        padding: 12px;
    }
}
footer {
    background: #a7c7e7;
    color: #fff;
    text-align: center;
    padding: 10px 0;
    position: fixed;
    width: 100%;
    bottom: 0;
    left: 0;
}
input, textarea, button {
    font-size: 1em;
    margin: 8px 0;
    padding: 8px;
    border-radius: 5px;
    border: 1px solid #a7c7e7;
}
button {
    background: #e75480;
    color: #fff;
    border: none;
    cursor: pointer;
}
button:hover {
    background: #a7c7e7;
    color: #3a4a6b;
}

.btn--edit {
    background-color: #f97316;
    color: #ffffff;
}

.btn--edit:hover {
    background-color: #ea580c;
}

.btn--pink {
    background-color: #ec4899;
    color: #ffffff;
}

.btn--pink:hover {
    background-color: #db2777;
}

.site-header {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    position: sticky;
    top: 0;
    z-index: 100;
}

.site-header__inner {
    width: min(1100px, 92%);
    margin: 0 auto;
    padding: 0.85rem 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand {
    text-decoration: none;
    color: #ffffff;
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.brand__title {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.2px;
}

.brand__subtitle {
    font-size: 0.82rem;
    opacity: 0.9;
    font-weight: 500;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.main-nav__link {
    text-decoration: none;
    color: #eaf2ff;
    font-weight: 600;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    transition: all 0.2s ease;
}

.main-nav__link:hover,
.main-nav__link:focus-visible {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    outline: none;
}

.main-nav__link.is-active {
    background: #ffffff;
    color: #1d4ed8;
}

@media (max-width: 760px) {
    .site-header__inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .main-nav {
        width: 100%;
        flex-wrap: wrap;
    }
}

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
    padding: 2rem;
}

.login-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    width: 100%;
    max-width: 400px;
}

.login-card__title {
    text-align: center;
    margin-bottom: 2rem;
    color: #333;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group__label {
    font-weight: 600;
    color: #333;
}

.form-group__input {
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group__input:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 5px rgba(76, 175, 80, 0.2);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    padding: 0.75rem 1rem;
    margin: 0;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
    box-sizing: border-box;
    min-width: 92px;
    min-height: 42px;
}

.btn--secondary {
    background-color: #e5e7eb;
    color: #1f2937;
}

.btn--tertiary {
    background-color: #ebe5ea;
    color: #1f2937;
}

.btn--secondary:hover {
    background-color: #d1d5db;
}

.btn--danger {
    background-color: #dc2626;
    color: #ffffff;
}

.btn--danger:hover {
    background-color: #b91c1c;
}

.btn--public {
    margin-left: 10px;
    margin-right: 10px;
    background-color: #16a34a;
    color: #ffffff;
}

.btn--private {
    background-color: #80746b;
    color: #ffffff;
}

.manage-lists {
    max-width: 1100px;
    margin: 2rem auto;
    padding: 0 2rem 2rem;
}

.manage-lists__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.manage-lists__title {
    margin: 0;
    color: #1f2937;
}

.manage-lists__subtitle {
    margin: 0.35rem 0 0;
    color: #6b7280;
}

.wordlist-grid {
    display: grid;
    /* Limit to maximum 2 wordlist cards per row */
    grid-template-columns: repeat(2, minmax(240px, 1fr));
    gap: 1rem;
}

@media (max-width: 640px) {
    /* On small screens, stack to a single column */
    .wordlist-grid {
        grid-template-columns: 1fr;
        grid-auto-flow: row;
    }
}

.wordlist-card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    padding: 1.25rem;
}

.wordlist-card__title {
    margin: 0 0 1rem;
    color: #111827;
}

.wordlist-card__actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.wordlist-card__actions form {
    margin: 0;
    display: inline-flex;
}

.wordlist-card__actions .btn {
    flex: 0 0 auto;
}

.wordlist-card__meta {
    margin: 0 0 1rem;
    color: #6b7280;
    font-size: 0.95rem;
}

.manage-lists__empty {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    padding: 2rem;
    text-align: center;
}

.alert {
    border-radius: 10px;
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
}

.alert--success {
    background: #dcfce7;
    color: #166534;
}

.alert--error {
    background: #fee2e2;
    color: #991b1b;
}

@media (max-width: 768px) {
    .manage-lists__top {
        flex-direction: column;
        align-items: stretch;
    }
}

.create-list-container {
    max-width: 1100px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.create-list-card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    padding: 2rem;
}

.create-list-card__title {
    margin: 0 0 1.5rem;
    color: #111827;
    font-size: 1.5rem;
}

.create-list-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.create-list-form__footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

.words-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.words-section__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.words-section__title {
    margin: 0;
    color: #111827;
}

.words-section__columns {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 0.75rem;
    padding: 0 0 0.25rem;
}

.word-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

/* Make CreateWordlist page use full available width */
.page-createwordlist .site-main {
    max-width: 1200px;
    margin: 1.5rem auto 2rem;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.page-createwordlist .create-list-container {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
}

.page-createwordlist .create-list-card {
    width: 100%;
    max-width: none;
    padding: 2rem;
}

.page-createwordlist .words-section__columns,
.page-createwordlist .word-row {
    display: grid;
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 0.85fr) minmax(140px, 160px);
    gap: 0.75rem;
    align-items: center;
}

.page-createwordlist .word-row .btn {
    width: 100%;
    min-width: 140px;
    white-space: nowrap;
}

.page-editwordlist .site-main {
    max-width: 1200px;
    margin: 1.5rem auto 2rem;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.page-editwordlist .create-list-container {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
}

.page-editwordlist .create-list-card {
    width: 100%;
    max-width: none;
    padding: 2rem;
}

.page-editwordlist .words-section__columns,
.page-editwordlist .word-row {
    display: grid;
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 0.85fr) minmax(140px, 160px);
    gap: 0.75rem;
    align-items: center;
}

.page-editwordlist .word-row .form-group__input {
    width: 100%;
}

.page-editwordlist .word-row .btn {
    width: 100%;
    min-width: 140px;
    white-space: nowrap;
}

@media (max-width: 900px) {
    .page-createwordlist .words-section__columns {
        display: none;
    }

    .page-createwordlist .word-row {
        grid-template-columns: 1fr;
    }

    .page-createwordlist .word-row .btn {
        width: auto;
        justify-self: start;
    }

    .page-editwordlist .words-section__columns {
        display: none;
    }

    .page-editwordlist .word-row {
        grid-template-columns: 1fr;
    }

    .page-editwordlist .word-row .btn {
        width: auto;
        justify-self: start;
    }
}

.practice-page {

display: grid;
place-items: center;
padding: 2rem 1rem;
}

.practice-form {
    width: 100%;
    max-width: 520px;
    background: #ffffff;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 0 auto;
}

.practice-form__word {
text-align: center;
font-size: 1.25rem;
margin: 0;
}

@media (max-width: 640px) {
    .practice-form {
        padding: 1rem;
        border-radius: 10px;
    }

    .practice-form__word {
        font-size: 1.1rem;
    }

    .practice-form__input {
        padding: 0.6rem;
        font-size: 1rem;
    }

    .practice-feedback {
        font-size: 0.95rem;
        padding: 0.5rem 0.75rem;
    }

    .btn {
        min-width: 72px;
        min-height: 40px;
        font-size: 0.95rem;
    }
}

/* Feedback styling for practice answers */
.practice-feedback {
    margin: 0 auto;
    padding: 0.6rem 0.9rem;
    border-radius: 8px;
    font-weight: 700;
    text-align: center;
    width: fit-content;
    max-width: 100%;
}

.practice-feedback--correct {
    background: #dcfce7; /* pale green */
    color: #166534; /* dark green */
    border: 1px solid rgba(16, 185, 129, 0.18);
}

.practice-feedback--incorrect {
    background: #fee2e2; /* pale red */
    color: #7f1d1d; /* dark red */
    border: 1px solid rgba(220, 38, 38, 0.12);
}


/* Center practice options and make them look like buttons */
.practice-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  text-align: center;
}

.practice-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* Button appearance for the links */
.practice-actions a {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  transition: background-color 0.15s, color 0.15s, transform 0.08s;
  cursor: pointer;
}

/* Primary / filled button */
.practice-actions a.btn-primary {
  background: #007bff;
  color: #fff;
  border: 1px solid #007bff;
}
.practice-actions a.btn-primary:hover {
  background: #0069d9;
}

/* Ghost / outline button */
.practice-actions a.btn-ghost {
  background: transparent;
  color: #007bff;
  border: 1px solid #007bff;
}
.practice-actions a.btn-ghost:hover {
  background: rgba(0, 123, 255, 0.08);
}

@media (max-width: 640px) {
    .site-header__inner {
        align-items: center;
    }
    .site-header{
        position: relative;
    }
    .main-nav {
        position: relative;
        justify-content: center;
        width: 100%;
    }
}

/* Page-specific mobile tweaks for EditWordlist/CreateWordlist */
@media (max-width: 640px) {
    .page-editwordlist .create-list-card,
    .page-createwordlist .create-list-card {
        padding: 1rem;
        border-radius: 10px;
    }

    .page-editwordlist .create-list-card .create-list-card__title,
    .page-createwordlist .create-list-card .create-list-card__title {
        font-size: 1.2rem;
        margin-bottom: 0.75rem;
    }

    .page-editwordlist .words-section__columns,
    .page-createwordlist .words-section__columns {
        display: none;
    }

    .page-editwordlist .word-row,
    .page-createwordlist .word-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        align-items: stretch;
    }

    .page-editwordlist .word-row .form-group__input,
    .page-createwordlist .word-row .form-group__input {
        width: 100%;
        padding: 0.6rem;
        font-size: 0.95rem;
    }

    /* Show small labels above inputs on narrow screens */
    .input-with-label {
        display: flex;
        flex-direction: column;
    }

    .input-label {
        display: none;
        font-weight: 600;
        margin-bottom: 0.25rem;
        color: #374151;
        font-size: 0.95rem;
    }

    .page-editwordlist .input-label,
    .page-createwordlist .input-label {
        display: block;
    }

    /* Make Add word button stack under title and expand to full width */
    .page-editwordlist .words-section__header,
    .page-createwordlist .words-section__header {
        display: flex !important;
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .page-editwordlist .words-section__header .btn,
    .page-createwordlist .words-section__header .btn {
        display: block;
        width: 100%;
        min-width: 0;
        white-space: normal;
        justify-self: stretch;
    }

    .page-editwordlist .words-section__title,
    .page-createwordlist .words-section__title {
        margin-bottom: 0;
    }

    .page-editwordlist .word-row .btn,
    .page-createwordlist .word-row .btn {
        width: 100%;
        min-width: 0;
        justify-self: stretch;
    }

    .page-editwordlist .create-list-form__footer,
    .page-createwordlist .create-list-form__footer {
        flex-direction: column-reverse;
        gap: 0.5rem;
        align-items: stretch;
    }

    .page-editwordlist .create-list-form__footer .btn,
    .page-createwordlist .create-list-form__footer .btn {
        width: 100%;
    }
}
