* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --green: #16a34a;
    --green-dark: #15803d;
    --green-soft: #dcfce7;
    --green-light: #f0fdf4;
    --text: #0f172a;
    --muted: #64748b;
    --line: #d9f3df;
    --white: #ffffff;
    --danger: #dc2626;
    --danger-soft: #fee2e2;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(22, 163, 74, 0.20), transparent 34%),
        linear-gradient(180deg, #f0fdf4 0%, #ffffff 42%, #f7fff9 100%);
}

.app {
    width: 100%;
    max-width: 540px;
    margin: 0 auto;
    padding: 18px 14px 28px;
}

.hero {
    background: linear-gradient(135deg, var(--green), #22c55e);
    color: white;
    border-radius: 28px;
    padding: 22px;
    box-shadow: 0 18px 42px rgba(22, 163, 74, 0.25);
    margin-bottom: 14px;
    position: relative;
    overflow: hidden;
}

.hero::after {
    content: "";
    position: absolute;
    width: 190px;
    height: 190px;
    right: -90px;
    top: -90px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
}

.hero-top {
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    z-index: 1;
}

.logo {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.20);
    display: grid;
    place-items: center;
    font-size: 22px;
    font-weight: 900;
    border: 1px solid rgba(255, 255, 255, 0.35);
    flex: 0 0 auto;
}

h1 {
    margin: 0;
    font-size: 25px;
    line-height: 1.15;
    letter-spacing: -0.4px;
}

.hero p {
    margin: 5px 0 0;
    opacity: 0.92;
    font-size: 14px;
    line-height: 1.4;
}

.hero-badge {
    width: max-content;
    max-width: 100%;
    margin-top: 18px;
    padding: 9px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    position: relative;
    z-index: 1;
}

.hero-badge span {
    width: 8px;
    height: 8px;
    background: #bbf7d0;
    border-radius: 50%;
    box-shadow: 0 0 0 5px rgba(187, 247, 208, 0.22);
}

.panel {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--line);
    border-radius: 26px;
    padding: 18px;
    box-shadow: 0 16px 45px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(10px);
}

.form {
    display: grid;
    gap: 10px;
}

label {
    font-weight: 800;
    font-size: 14px;
    color: #14532d;
}

.input-wrap {
    position: relative;
}

input {
    width: 100%;
    height: 58px;
    padding: 0 48px 0 16px;
    border: 1.5px solid #bbf7d0;
    border-radius: 18px;
    background: #fbfffc;
    font-size: 20px;
    font-family: "Courier New", monospace;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: #052e16;
    outline: none;
}

input:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.12);
}

.clear-btn {
    position: absolute;
    right: 8px;
    top: 8px;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 14px;
    background: var(--green-soft);
    color: var(--green-dark);
    font-size: 28px;
    line-height: 1;
    font-weight: 500;
    cursor: pointer;
}

.hint {
    margin: 0 0 6px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}

code {
    font-family: "Courier New", monospace;
}

.hint code,
.footer-note code {
    background: var(--green-soft);
    color: #166534;
    border-radius: 8px;
    padding: 2px 6px;
    font-weight: 800;
}

.generate-btn {
    width: 100%;
    min-height: 62px;
    border: none;
    border-radius: 19px;
    background: linear-gradient(135deg, var(--green), #22c55e);
    color: white;
    box-shadow: 0 12px 26px rgba(22, 163, 74, 0.28);
    cursor: pointer;
    display: grid;
    place-items: center;
    gap: 2px;
    font-weight: 900;
    font-size: 17px;
}

.generate-btn small {
    font-weight: 600;
    opacity: 0.86;
    font-size: 12px;
}

.generate-btn:active,
.number-item:active,
.copy-all:active {
    transform: scale(0.985);
}

.alert {
    margin-top: 16px;
    padding: 14px;
    border-radius: 18px;
    display: grid;
    gap: 4px;
    line-height: 1.4;
}

.error {
    background: var(--danger-soft);
    color: #991b1b;
    border: 1px solid #fecaca;
}

.result-card {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px dashed #bbf7d0;
}

.result-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.result-head h2,
.empty-state h2 {
    margin: 0;
    font-size: 19px;
    letter-spacing: -0.2px;
}

.result-head p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.time-info {
    font-size: 12px !important;
}

.copy-all {
    border: none;
    border-radius: 14px;
    background: var(--green-soft);
    color: var(--green-dark);
    font-weight: 900;
    padding: 12px 13px;
    cursor: pointer;
    white-space: nowrap;
}

.safe-refresh {
    margin: 0 0 12px;
    padding: 11px 12px;
    border-radius: 15px;
    background: var(--green-light);
    border: 1px solid #bbf7d0;
    color: #166534;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.4;
}

textarea {
    position: absolute;
    left: -99999px;
    opacity: 0;
    pointer-events: none;
}

.result-list {
    display: grid;
    gap: 9px;
}

.number-item {
    width: 100%;
    min-height: 55px;
    display: grid;
    grid-template-columns: 38px 1fr auto;
    align-items: center;
    gap: 10px;
    border: 1px solid #dcfce7;
    border-radius: 18px;
    background: #ffffff;
    padding: 10px;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
    text-align: left;
}

.number-item:hover {
    border-color: #86efac;
    background: #fbfffc;
}

.number-index {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    background: var(--green-light);
    color: var(--green-dark);
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 900;
}

.number-item code {
    color: #052e16;
    font-size: 17px;
    font-weight: 900;
    word-break: break-all;
}

.copy-label {
    color: var(--green-dark);
    background: var(--green-soft);
    border-radius: 999px;
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 900;
}

.empty-state {
    margin-top: 18px;
    background: var(--green-light);
    border: 1px solid #bbf7d0;
    border-radius: 22px;
    padding: 18px;
    text-align: center;
}

.empty-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 10px;
    border-radius: 17px;
    display: grid;
    place-items: center;
    background: var(--green);
    color: white;
    font-weight: 900;
    font-size: 22px;
}

.empty-state p {
    margin: 8px 0 0;
    color: var(--muted);
    line-height: 1.5;
    font-size: 14px;
}

.info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 14px;
}

.info div {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 14px;
    display: grid;
    gap: 4px;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.04);
}

.info b {
    color: #14532d;
    font-size: 13px;
}

.info span {
    color: var(--muted);
    font-size: 12px;
    word-break: break-all;
}

.footer-note {
    margin: 16px 4px 0;
    text-align: center;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
}

#toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%) translateY(20px);
    width: calc(100% - 28px);
    max-width: 520px;
    background: #052e16;
    color: white;
    padding: 14px 16px;
    border-radius: 18px;
    opacity: 0;
    pointer-events: none;
    transition: 0.22s ease;
    font-size: 14px;
    font-weight: 800;
    text-align: center;
    box-shadow: 0 16px 38px rgba(5, 46, 22, 0.28);
    z-index: 50;
}

#toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

@media (min-width: 720px) {
    .app {
        padding-top: 34px;
    }
}

@media (max-width: 380px) {
    .app {
        padding-left: 10px;
        padding-right: 10px;
    }

    .hero,
    .panel {
        border-radius: 22px;
    }

    h1 {
        font-size: 22px;
    }

    input {
        font-size: 17px;
    }

    .number-item {
        grid-template-columns: 34px 1fr;
    }

    .copy-label {
        grid-column: 2;
        width: max-content;
    }

    .info {
        grid-template-columns: 1fr;
    }
}
