:root {
    --ink: #182824;
    --muted: #697773;
    --line: #dfe7e3;
    --soft: #f2f7f4;
    --green: #147f60;
    --green-dark: #0d674d;
    --green-pale: #e5f4ed;
    --orange: #ef8f43;
    --danger: #c44747;
    --shadow: 0 24px 70px rgba(27, 52, 44, 0.09);
    --radius: 22px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { min-height: 100%; }

body {
    width: 100%;
    max-width: 100vw;
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background: #f7faf8;
    font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
    font-feature-settings: "palt";
    -webkit-font-smoothing: antialiased;
    position: relative;
    overflow-x: hidden;
}

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

.ambient {
    position: fixed;
    z-index: -1;
    border-radius: 50%;
    filter: blur(2px);
    pointer-events: none;
}

.ambient-one {
    width: 480px;
    height: 480px;
    top: 80px;
    left: -270px;
    background: radial-gradient(circle, rgba(114, 199, 159, 0.16), rgba(114, 199, 159, 0));
}

.ambient-two {
    width: 600px;
    height: 600px;
    top: 350px;
    right: -360px;
    background: radial-gradient(circle, rgba(244, 174, 105, 0.13), rgba(244, 174, 105, 0));
}

.site-header {
    width: min(1180px, calc(100% - 48px));
    height: 88px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: var(--ink);
    text-decoration: none;
}

.brand-mark {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 3px;
    padding: 7px 6px;
    border-radius: 10px;
    background: var(--green);
    transform: rotate(-3deg);
}

.brand-mark span {
    width: 5px;
    background: #fff;
    border-radius: 5px;
    transform: rotate(3deg);
}

.brand-mark span:nth-child(1) { height: 9px; }
.brand-mark span:nth-child(2) { height: 18px; }
.brand-mark span:nth-child(3) { height: 13px; }

.brand-copy { display: grid; line-height: 1; }
.brand-copy strong { font-size: 14px; letter-spacing: .13em; }
.brand-copy small { margin-top: 5px; color: var(--green); font-size: 9px; font-weight: 800; letter-spacing: .3em; }

.secure-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #7d8985;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.secure-label svg {
    width: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.header-actions { display: flex; align-items: center; gap: 18px; }
.logout-form { margin: 0; padding-left: 18px; border-left: 1px solid var(--line); }
.logout-form button { padding: 7px 10px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; font-size: 10px; font-weight: 700; cursor: pointer; }
.logout-form button:hover { color: var(--green); background: var(--green-pale); }

.page-shell {
    width: min(760px, calc(100% - 40px));
    margin: 56px auto 72px;
}

.intro { margin: 0 0 38px; text-align: center; }
.eyebrow { margin: 0 0 12px; color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: .23em; }

.intro h1 {
    margin: 0;
    font-size: clamp(30px, 5vw, 42px);
    line-height: 1.35;
    letter-spacing: .025em;
}

.intro > p:last-child {
    margin: 17px 0 0;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.9;
}

.upload-card, .download-card {
    border: 1px solid rgba(220, 230, 225, .85);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .94);
    box-shadow: var(--shadow);
}

.upload-card { padding: 42px 46px 38px; }

.section-heading {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 22px;
}

.section-heading.compact { margin-bottom: 27px; }

.step-number {
    width: 29px;
    height: 29px;
    flex: 0 0 29px;
    display: grid;
    place-items: center;
    margin-top: 2px;
    border-radius: 50%;
    color: var(--green);
    background: var(--green-pale);
    font-family: Arial, sans-serif;
    font-size: 13px;
    font-weight: 800;
}

.section-heading > div { min-width: 0; }
.section-heading h2 { margin: 0; font-size: 19px; line-height: 1.5; letter-spacing: .02em; }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 13px; line-height: 1.7; }

.dropzone {
    width: 100%;
    min-height: 230px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 30px;
    border: 1.5px dashed #a9c8bb;
    border-radius: 16px;
    background: #f8fbf9;
    cursor: pointer;
    transition: .2s ease;
}

.dropzone:hover, .dropzone.is-dragging {
    border-color: var(--green);
    background: #eef8f3;
    transform: translateY(-1px);
}

.dropzone:focus-visible { outline: 3px solid rgba(20, 127, 96, .18); outline-offset: 3px; }
.dropzone:disabled { cursor: wait; opacity: .65; }

.upload-icon {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    margin-bottom: 6px;
    border-radius: 18px;
    color: var(--green);
    background: var(--green-pale);
}

.upload-icon svg { width: 28px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.dropzone strong { font-size: 16px; letter-spacing: .015em; }
.dropzone > span:not(.upload-icon) { color: #82908b; font-size: 13px; }
.dropzone em { color: var(--green); font-style: normal; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.dropzone small { margin-top: 7px; padding: 5px 12px; border-radius: 20px; color: #76847f; background: #edf2ef; font-size: 11px; font-weight: 700; letter-spacing: .08em; }

.file-list { margin-top: 16px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.file-list-head { display: flex; justify-content: space-between; padding: 12px 15px; color: var(--muted); background: #f7f9f8; font-size: 12px; }
.file-list-head strong { color: var(--green); }
.file-list ul, .download-file-list { list-style: none; margin: 0; padding: 0; }
.file-list li, .download-file-list li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid #edf1ef; }

.file-type {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    color: var(--green);
    background: var(--green-pale);
    font-family: Arial, sans-serif;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .04em;
}

.file-info { min-width: 0; flex: 1; display: grid; gap: 4px; }
.file-info strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.file-info small { color: var(--muted); font-size: 11px; }
.file-list li button { width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 8px; color: #89948f; background: transparent; cursor: pointer; }
.file-list li button:hover { color: var(--danger); background: #fff1f1; }
.file-list li button svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

.form-divider { height: 1px; margin: 37px 0 36px; background: #e8eeeb; }
.setting-block { min-width: 0; margin: 0 0 30px; padding: 0; border: 0; }
.setting-block legend { margin-bottom: 12px; font-size: 13px; font-weight: 700; }
.period-options { min-width: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.period-option { cursor: pointer; }
.period-option input { position: absolute; opacity: 0; pointer-events: none; }

.period-option > span {
    min-height: 67px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #fff;
    transition: .18s ease;
}

.period-option strong { font-size: 13px; }
.period-option small { color: var(--orange); font-size: 8px; font-weight: 800; }
.period-option input:checked + span { border-color: var(--green); color: var(--green); background: var(--green-pale); box-shadow: inset 0 0 0 1px var(--green); }
.period-option input:focus-visible + span { outline: 3px solid rgba(20, 127, 96, .18); outline-offset: 2px; }
.period-option:hover > span { border-color: #8bb6a5; }
.setting-note { margin: 10px 0 0; color: #7f8c87; font-size: 12px; line-height: 1.7; }

.password-block { padding: 20px; border-radius: 13px; background: #f7f9f8; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.switch-label { display: grid; gap: 4px; }
.switch-label > span { font-size: 13px; font-weight: 700; }
.switch-label small { color: var(--muted); font-size: 11px; line-height: 1.7; }
.switch { flex: 0 0 auto; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch > span { width: 43px; height: 24px; display: block; padding: 3px; border-radius: 30px; background: #b6c1bd; transition: .2s; }
.switch > span::after { content: ""; width: 18px; height: 18px; display: block; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.18); transition: .2s; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(19px); }
.switch input:focus-visible + span { outline: 3px solid rgba(20, 127, 96, .2); outline-offset: 2px; }

.password-area { margin-top: 17px; padding-top: 16px; border-top: 1px solid #e3e9e6; }
.password-area > label, .download-password-form > label { display: block; margin: 0 0 8px; color: #53615d; font-size: 12px; font-weight: 700; }
.password-input-wrap { position: relative; }
.password-input-wrap input {
    width: 100%;
    height: 48px;
    padding: 0 48px 0 14px;
    border: 1px solid #cfdbd6;
    border-radius: 10px;
    color: var(--ink);
    background: #fff;
    font-size: 13px;
    outline: none;
    transition: .18s;
}
.password-input-wrap input.visible-password { padding-right: 14px; }
.password-input-wrap input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(20, 127, 96, .11); }
.password-input-wrap input::placeholder { color: #aab4b0; }
.icon-button { position: absolute; top: 50%; right: 8px; width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 7px; color: #84908c; background: transparent; transform: translateY(-50%); cursor: pointer; }
.icon-button:hover { color: var(--green); background: var(--soft); }
.icon-button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.inline-error, .submit-error { margin: 9px 0 0; color: var(--danger); font-size: 12px; line-height: 1.6; }
.submit-error { text-align: center; }

.progress-area { margin: 25px 0 18px; padding: 16px; border-radius: 12px; background: var(--soft); }
.progress-copy { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; font-size: 12px; }
.progress-copy span { overflow: hidden; color: #53615d; text-overflow: ellipsis; white-space: nowrap; }
.progress-copy strong { color: var(--green); }
.progress-track { height: 7px; overflow: hidden; border-radius: 10px; background: #dce8e2; }
.progress-track span { width: 0; height: 100%; display: block; border-radius: inherit; background: linear-gradient(90deg, var(--green), #49ad86); transition: width .2s; }
.progress-area p { margin: 8px 0 0; color: #89948f; font-size: 9px; text-align: center; }

.primary-button, .secondary-button {
    border: 0;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: .2s ease;
}

.primary-button {
    width: 100%;
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #fff;
    background: var(--green);
    box-shadow: 0 10px 24px rgba(20, 127, 96, .2);
    font-size: 13px;
}

.primary-button svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.primary-button:hover:not(:disabled) { background: var(--green-dark); transform: translateY(-1px); box-shadow: 0 13px 28px rgba(20, 127, 96, .25); }
.primary-button:disabled { color: #9ea8a4; background: #e4e9e7; box-shadow: none; cursor: not-allowed; }
.primary-button:focus-visible, .secondary-button:focus-visible { outline: 3px solid rgba(20, 127, 96, .2); outline-offset: 3px; }

.privacy-note { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 20px 0 0; color: #82908b; font-size: 11px; }
.privacy-note svg { width: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.success-panel { padding: 25px 10px 12px; text-align: center; }
.success-icon { width: 64px; height: 64px; display: grid; place-items: center; margin: 0 auto 22px; border-radius: 50%; color: var(--green); background: var(--green-pale); }
.success-icon svg { width: 34px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.success-panel h2 { margin: 0; font-size: 25px; }
.success-panel > p:not(.eyebrow) { margin: 12px 0 25px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.share-url-box { display: flex; padding: 5px; border: 1px solid #cddbd5; border-radius: 12px; background: #f8faf9; }
.share-url-box input { min-width: 0; flex: 1; padding: 0 12px; border: 0; color: var(--ink); background: transparent; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; outline: none; }
.share-url-box button { flex: 0 0 auto; height: 42px; display: flex; align-items: center; gap: 7px; padding: 0 15px; border: 0; border-radius: 8px; color: #fff; background: var(--green); font-size: 11px; font-weight: 700; cursor: pointer; }
.share-url-box button.is-copied { background: var(--ink); }
.share-url-box button svg { width: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.success-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 22px 0; overflow: hidden; border-radius: 11px; background: var(--line); }
.success-meta div { display: grid; gap: 5px; padding: 15px; background: #f7f9f8; }
.success-meta dt { color: var(--muted); font-size: 9px; }
.success-meta dd { margin: 0; font-size: 11px; font-weight: 700; }
.secondary-button { padding: 12px 19px; color: var(--green); background: var(--green-pale); font-size: 11px; }
.secondary-button:hover { background: #d8eee4; }

footer {
    width: min(1180px, calc(100% - 48px));
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 auto;
    color: #9ba5a1;
    font-family: Arial, sans-serif;
    font-size: 9px;
    letter-spacing: .08em;
}

/* Receiver */
.download-page { display: flex; flex-direction: column; }
.download-page .site-header { flex: 0 0 auto; }
.download-shell { width: min(680px, calc(100% - 40px)); flex: 1; display: grid; place-items: center; margin: 45px auto 70px; }
.download-card { width: 100%; padding: 48px 50px; text-align: center; }
.download-card h1 { margin: 0; font-size: 25px; line-height: 1.5; }
.download-card > p:not(.eyebrow):not(.download-summary) { margin: 11px 0 0; color: var(--muted); font-size: 13px; line-height: 1.8; }
.lock-icon, .download-icon, .state-icon { width: 65px; height: 65px; display: grid; place-items: center; margin: 0 auto 22px; border-radius: 20px; color: var(--green); background: var(--green-pale); }
.lock-icon svg, .download-icon svg, .state-icon svg { width: 31px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.state-icon { color: #9b7655; background: #f6eee7; }
.download-password-form { max-width: 400px; margin: 28px auto 0; text-align: left; }
.download-password-form .primary-button { min-height: 52px; margin-top: 16px; }
.download-summary { margin: 8px 0 27px; color: var(--green); font-size: 11px; font-weight: 700; }
.download-file-list { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; text-align: left; }
.download-file-list li:first-child { border-top: 0; }
.download-file-list li { padding: 14px; }
.download-file-list a { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; padding: 9px 12px; border-radius: 8px; color: var(--green); background: var(--green-pale); font-size: 10px; font-weight: 700; text-decoration: none; }
.download-file-list a:hover { color: #fff; background: var(--green); }
.download-file-list a svg { width: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.expiry-box { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 22px; padding: 13px; border-radius: 10px; color: var(--muted); background: #f5f8f6; font-size: 10px; }
.expiry-box svg { width: 15px; fill: none; stroke: var(--green); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.expiry-box strong { color: var(--ink); }
.password-expiry-box { max-width: 400px; margin: 20px auto 0; }

/* Admin login */
.login-page { min-height: 100vh; display: flex; flex-direction: column; }
.login-shell { width: min(510px, calc(100% - 40px)); flex: 1; display: grid; place-items: center; margin: 45px auto 70px; }
.login-card { padding: 45px 50px 48px; }
.login-card h1 { margin: 0; font-size: 25px; line-height: 1.5; }
.login-card > p:not(.eyebrow) { margin: 11px 0 0; color: var(--muted); font-size: 13px; line-height: 1.8; }
.login-form { margin-top: 28px; text-align: left; }
.login-form > label { display: block; margin: 16px 0 8px; color: #53615d; font-size: 10px; font-weight: 700; }
.login-form > label:first-of-type { margin-top: 0; }
.login-form > input:not([type="hidden"]) {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    border: 1px solid #cfdbd6;
    border-radius: 10px;
    color: var(--ink);
    background: #fff;
    font-size: 13px;
    outline: none;
    transition: .18s;
}
.login-form > input:not([type="hidden"]):focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(20, 127, 96, .11); }
.login-form input::placeholder { color: #aab4b0; }
.login-form .primary-button { min-height: 52px; margin-top: 22px; }
.login-error { margin: 13px 0 -4px; padding: 10px 12px; border-radius: 8px; color: var(--danger); background: #fff1f1; font-size: 10px; line-height: 1.6; }

@media (max-width: 680px) {
    .site-header { width: calc(100% - 32px); height: 72px; }
    .secure-label { font-size: 0; }
    .secure-label svg { width: 17px; }
    .header-actions { gap: 8px; }
    .logout-form { padding-left: 8px; }
    .page-shell { width: calc(100vw - 24px); max-width: calc(100vw - 24px); margin-top: 35px; }
    .intro { margin-bottom: 27px; }
    .intro h1 { padding: 0 8px; font-size: 26px; line-break: strict; overflow-wrap: anywhere; }
    .intro > p:last-child { font-size: 13px; }
    .desktop-only { display: none; }
    .upload-card { width: 100%; min-width: 0; max-width: 100%; padding: 29px 20px 27px; overflow: hidden; border-radius: 18px; }
    .dropzone { min-height: 205px; padding: 24px 15px; }
    .period-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .period-option > span { min-height: 58px; }
    .setting-row { align-items: flex-start; }
    .switch-label small { padding-right: 5px; }
    .primary-button { padding: 0 16px; font-size: 12px; }
    .success-panel { padding: 15px 0 4px; }
    .success-panel h2 { font-size: 21px; }
    .share-url-box { display: grid; }
    .share-url-box input { height: 44px; padding: 0 9px; font-size: 11px; text-align: center; }
    .share-url-box button { justify-content: center; }
    .success-meta { grid-template-columns: 1fr; }
    footer { width: calc(100% - 32px); min-height: 65px; }
    .download-shell { width: calc(100vw - 24px); max-width: calc(100vw - 24px); margin: 30px auto 50px; }
    .download-card { padding: 38px 20px; border-radius: 18px; }
    .download-card h1 { font-size: 21px; }
    .download-file-list li { align-items: flex-start; flex-wrap: wrap; }
    .download-file-list .file-info { width: calc(100% - 54px); flex: none; padding-top: 4px; }
    .download-file-list a { width: 100%; justify-content: center; margin-top: 3px; }
    .expiry-box { flex-wrap: wrap; line-height: 1.5; }
    .login-shell { width: calc(100vw - 24px); max-width: calc(100vw - 24px); margin: 30px auto 50px; }
    .login-card { padding: 38px 24px 40px; }
    .login-card h1 { font-size: 21px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
