* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --green-900: #123d2c;
    --green-800: #165236;
    --green-700: #1f6b45;
    --green-600: #2f855a;
    --green-100: #dff3e7;
    --green-50: #f3fbf6;
    --ink: #17211b;
    --muted: #5f6f66;
    --line: #cfe3d6;
    --paper: #ffffff;
    --shadow: 0 18px 45px rgba(18, 61, 44, 0.14);
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    background:
        linear-gradient(180deg, rgba(223, 243, 231, 0.78), rgba(255, 255, 255, 0.92) 48%),
        var(--green-50);
    color: var(--ink);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
    color: var(--green-700);
    font-weight: 800;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

.app-shell {
    width: min(100% - 28px, 520px);
    flex: 1;
    display: flex;
    align-items: center;
    padding: 28px 0 18px;
}

.panel {
    width: 100%;
    min-height: 560px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow);
    padding: 30px 22px;
}

.panel[hidden] {
    display: none;
}

.eyebrow {
    margin-bottom: 12px;
    color: var(--green-700);
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1,
h2 {
    color: var(--green-900);
    line-height: 1.18;
    letter-spacing: 0;
    word-break: keep-all;
}

h1 {
    font-size: 2.2rem;
}

h2 {
    margin-top: 26px;
    font-size: 1.7rem;
    text-align: center;
}

.lead {
    margin-top: 16px;
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.65;
    word-break: keep-all;
}

.info-list {
    margin: 28px 0 32px;
    padding-left: 1.15rem;
    color: #31453a;
    line-height: 1.65;
}

.info-list li + li {
    margin-top: 10px;
}

.primary-button,
.secondary-button {
    width: 100%;
    min-height: 54px;
    border: 0;
    border-radius: 14px;
    cursor: pointer;
    font-size: 1.05rem;
    font-weight: 900;
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.primary-button {
    background: var(--green-700);
    color: #fff;
}

.primary-button:hover {
    background: var(--green-800);
}

.secondary-button {
    background: #fff;
    border: 1px solid var(--line);
    color: var(--green-800);
}

.secondary-button:hover {
    border-color: var(--green-600);
}

.primary-button:active,
.secondary-button:active {
    transform: translateY(1px);
}

.primary-button:focus-visible,
.secondary-button:focus-visible,
.link-display:focus-visible,
.info-list a:focus-visible {
    outline: 3px solid #a8dcbc;
    outline-offset: 3px;
}

.loading-view {
    align-items: center;
    text-align: center;
}

.loading-view p {
    margin-top: 10px;
    color: var(--muted);
}

.loader {
    width: 74px;
    height: 74px;
    border: 7px solid var(--green-100);
    border-top-color: var(--green-700);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.result-view {
    text-align: center;
}

.word-display {
    min-height: 170px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 16px 0 8px;
    padding: 20px 14px;
    border-radius: 18px;
    background: var(--green-50);
    color: var(--green-900);
    font-size: 2.5rem;
    font-weight: 900;
    line-height: 1.12;
    text-decoration: none;
    word-break: keep-all;
    transition: background 0.15s ease, transform 0.15s ease;
}

.word-display:hover {
    background: var(--green-100);
}

.word-display:active {
    transform: translateY(1px);
}

.link-display {
    display: inline-flex;
    width: 100%;
    min-height: 52px;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: var(--green-100);
    color: var(--green-800);
    font-weight: 900;
    margin-bottom: 22px;
    text-decoration: none;
}

.link-display:hover {
    background: #ccebd9;
}

.link-display[hidden] {
    display: none;
}

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

.share-status {
    min-height: 22px;
    margin-top: 14px;
    color: var(--green-700);
    font-size: 0.92rem;
    font-weight: 800;
}

.comments {
    width: min(100% - 28px, 640px);
    margin: 12px 0 0;
    overflow: hidden;
}

@media (min-width: 700px) {
    .app-shell {
        padding-top: 48px;
    }

    .panel {
        min-height: 600px;
        padding: 42px 38px;
        border-radius: 28px;
    }

    h1 {
        font-size: 2.65rem;
    }

    .word-display {
        font-size: 3rem;
    }
}

@media (max-width: 380px) {
    .app-shell {
        width: min(100% - 18px, 520px);
        padding-top: 12px;
    }

    .panel {
        min-height: 520px;
        padding: 24px 18px;
        border-radius: 20px;
    }

    h1 {
        font-size: 1.9rem;
    }

    .word-display {
        min-height: 150px;
        font-size: 2.1rem;
    }

    .action-row {
        grid-template-columns: 1fr;
    }
}
