* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: #1f2933;
    background: #f4f7f6;
    font-family: "Yu Gothic", "Meiryo", system-ui, sans-serif;
    line-height: 1.7;
}

.public-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 28px 16px;
    background:
        linear-gradient(180deg, #eaf6ff 0%, #f7fbff 42%, #eef7ff 100%);
}

.support-card {
    width: min(100%, 720px);
    padding: clamp(24px, 5vw, 44px);
    border: 1px solid #cfe5f7;
    border-top: 10px solid var(--theme-color, #1f6feb);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 20px 48px rgba(31, 95, 139, 0.14);
}

.support-header {
    margin-bottom: 26px;
    text-align: center;
}

.support-version {
    margin: 0 0 8px;
    color: #42677e;
    font-size: 1rem;
    font-weight: 700;
}

.form-title {
    margin: 0;
    color: var(--theme-color, #1f6feb);
    text-align: center;
    font-size: 40px;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: 0;
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: keep-all;
    transform-origin: center;
}

.form-title.long-title {
    font-size: 32px;
    letter-spacing: 0;
}

.form-title.very-long-title {
    font-size: 28px;
    letter-spacing: 0;
}

.form-title.allow-wrap {
    white-space: normal;
    line-height: 1.32;
}

.support-lead {
    margin: 18px auto 0;
    color: #253f52;
    font-size: clamp(16px, 2.5vw, 21px);
    font-weight: 700;
    line-height: 1.8;
}

.logo-frame {
    max-width: 100%;
    margin: 0 auto 20px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.logo-frame img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: var(--logo-fit, contain);
    object-position: var(--logo-position-x, 50%) var(--logo-position-y, 50%);
}

.public-logo-frame {
    background: transparent;
}

.support-form {
    display: grid;
    gap: 20px;
}

.support-field {
    display: grid;
    gap: 10px;
    color: #173b55;
    font-size: 1.18rem;
    font-weight: 700;
}

.support-field input,
.support-field textarea {
    min-height: 60px;
    padding: 14px 16px;
    border: 2px solid #b8d8ef;
    border-radius: 8px;
    background: #ffffff;
    color: #1f2933;
    font-size: 18px;
    width: 100%;
    box-sizing: border-box;
}

.support-field textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.7;
}

.support-field input::placeholder,
.support-field textarea::placeholder {
    color: #8aa3b5;
}

.support-field input:focus,
.support-field textarea:focus,
.support-check:focus-within {
    border-color: var(--theme-color, #1f6feb);
    outline: 4px solid color-mix(in srgb, var(--theme-color, #1f6feb) 18%, transparent);
}

.required-mark {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #b42318;
    color: #ffffff;
    font-size: 0.78rem;
    font-style: normal;
    line-height: 1;
    vertical-align: middle;
}

.support-check {
    display: grid;
    grid-template-columns: 34px 1fr;
    gap: 14px;
    align-items: start;
    min-height: 68px;
    padding: 18px;
    border: 2px solid #cfe5f7;
    border-radius: 8px;
    background: #f7fbff;
    color: #173b55;
    cursor: pointer;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.6;
    user-select: none;
}

.support-check input {
    width: 28px;
    height: 28px;
    margin: 3px 0 0;
    accent-color: var(--theme-color, #1f6feb);
    cursor: pointer;
}

.privacy-box {
    padding: 20px;
    border: 1px solid #cfe5f7;
    border-left: 6px solid var(--theme-color, #1f6feb);
    border-radius: 8px;
    background: #f3f9ff;
}

.privacy-box h2 {
    margin: 0 0 10px;
    color: var(--theme-color, #1f6feb);
    font-size: 1.18rem;
}

.privacy-box p {
    margin: 0;
    color: #2e4a5e;
    font-size: 16px;
    line-height: 1.85;
}

.support-submit,
.support-back-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 64px;
    padding: 16px 22px;
    border: 0;
    border-radius: 8px;
    background: var(--theme-color, #1f6feb);
    color: #ffffff;
    cursor: pointer;
    font: inherit;
    font-size: 20px;
    font-weight: 800;
    text-align: center;
    box-shadow: 0 10px 22px rgba(15, 114, 184, 0.24);
}

.support-submit:hover,
.support-back-button:hover {
    filter: brightness(0.9);
}

.error-box {
    margin: 0 0 22px;
    padding: 16px 18px;
    border: 2px solid #e57474;
    border-radius: 8px;
    background: #fff5f5;
    color: #b42318;
    font-size: 1.05rem;
    font-weight: 700;
}

.error-box p {
    margin: 6px 0 0;
}

.error-box .error-title {
    margin: 0 0 8px;
    font-size: 1.14rem;
}

.thanks-card {
    text-align: center;
}

.thanks-message {
    margin: 22px 0 30px;
    color: #253f52;
    font-size: clamp(18px, 3vw, 22px);
    font-weight: 700;
    line-height: 1.85;
}

.support-back-button {
    width: min(100%, 360px);
    margin: 0 auto;
}

a {
    color: inherit;
    text-decoration: none;
}

.page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 32px 16px;
}

.panel {
    width: min(100%, 720px);
    padding: 32px;
    border: 1px solid #d8e2dc;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 16px 40px rgba(31, 41, 51, 0.08);
}

.panel.narrow {
    width: min(100%, 460px);
}

.center {
    text-align: center;
}

.version {
    margin: 0 0 6px;
    color: #5f6c72;
    font-size: 0.9rem;
}

h1 {
    margin: 0 0 24px;
    font-size: 1.85rem;
    line-height: 1.3;
}

h2 {
    margin: 0 0 8px;
    font-size: 1.05rem;
}

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

.field {
    display: grid;
    gap: 8px;
    font-weight: 700;
}

input[type="text"],
input[type="password"],
input[type="search"] {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #c8d3ce;
    border-radius: 6px;
    background: #ffffff;
    font: inherit;
}

input:focus {
    border-color: #2f7d62;
    outline: 3px solid rgba(47, 125, 98, 0.16);
}

.check-row {
    display: grid;
    grid-template-columns: 22px 1fr;
    gap: 10px;
    align-items: start;
    padding: 14px;
    border: 1px solid #d8e2dc;
    border-radius: 6px;
    background: #fbfdfc;
}

.check-row input {
    width: 18px;
    height: 18px;
    margin-top: 4px;
}

.notice {
    padding: 18px;
    border-left: 4px solid #2f7d62;
    border-radius: 6px;
    background: #eef7f2;
}

.notice p {
    margin: 0;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    text-align: center;
}

.button.primary {
    color: #ffffff;
    background: #2f7d62;
}

.button.secondary {
    color: #1f2933;
    border-color: #c8d3ce;
    background: #ffffff;
}

.button.danger {
    color: #ffffff;
    background: #b42318;
}

.button.small {
    min-height: 38px;
    padding: 7px 12px;
    font-size: 0.92rem;
}

.alert {
    margin: 0 0 18px;
    padding: 12px 14px;
    border: 1px solid #f2c94c;
    border-radius: 6px;
    background: #fff8dc;
}

.alert p {
    margin: 0;
}

.admin-page {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0;
}

.admin-header,
.toolbar {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.admin-header h1 {
    margin-bottom: 0;
}

.admin-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.admin-actions form {
    margin: 0;
}

.toolbar {
    flex-wrap: wrap;
    padding: 16px;
    border: 1px solid #d8e2dc;
    border-radius: 8px;
    background: #ffffff;
}

.admin-toolbar {
    align-items: stretch;
}

.toolbar-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.bulk-select-control {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    min-height: 38px;
    padding: 7px 12px;
    border: 1px solid #c8d3ce;
    border-radius: 6px;
    background: #ffffff;
    cursor: pointer;
    font-weight: 700;
    white-space: nowrap;
}

.bulk-select-control input {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.select-col {
    width: 48px;
    text-align: center;
}

.select-col input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.total {
    white-space: nowrap;
}

.search-form {
    display: flex;
    flex: 1 1 360px;
    gap: 8px;
    align-items: center;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid #d8e2dc;
    border-radius: 8px;
    background: #ffffff;
}

table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
}

th,
td {
    padding: 12px 14px;
    border-bottom: 1px solid #e6eeea;
    text-align: left;
    vertical-align: middle;
}

th {
    color: #425159;
    background: #f7faf9;
    font-size: 0.92rem;
}

tr:last-child td {
    border-bottom: 0;
}

.empty {
    color: #5f6c72;
    text-align: center;
}

.alert.success {
    border-color: #8fcf9f;
    background: #edf9f0;
}

.settings-form {
    margin: 0;
}

.settings-card {
    display: grid;
    gap: 18px;
    padding: 24px;
    border: 1px solid #d8e2dc;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 12px 30px rgba(31, 41, 51, 0.06);
}

.settings-field {
    display: grid;
    gap: 8px;
    color: #243b47;
    font-weight: 700;
}

.settings-field input,
.settings-field textarea,
.settings-field select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #c8d3ce;
    border-radius: 6px;
    background: #ffffff;
    color: #1f2933;
    font: inherit;
}

.settings-field input[type="file"] {
    padding: 10px;
}

.settings-field input[type="range"] {
    padding: 0;
    accent-color: #2f7d62;
}

.settings-field input {
    min-height: 46px;
}

.settings-field textarea {
    min-height: 92px;
    resize: vertical;
    line-height: 1.7;
}

.settings-field input:focus,
.settings-field textarea:focus,
.settings-field select:focus {
    border-color: #2f7d62;
    outline: 3px solid rgba(47, 125, 98, 0.16);
}

.logo-settings-section,
.extra-settings-section,
.display-settings-section {
    display: grid;
    gap: 14px;
    padding: 18px;
    border: 1px solid #d8e2dc;
    border-radius: 8px;
    background: #f7faf9;
}

.logo-settings-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 380px);
    gap: 18px;
    align-items: start;
}

.logo-settings-controls,
.logo-preview-panel {
    display: grid;
    gap: 14px;
}

.logo-range-grid {
    display: grid;
    gap: 12px;
}

.logo-preview-panel {
    padding: 16px;
    border: 1px solid #d8e2dc;
    border-radius: 8px;
    background: #ffffff;
}

.logo-preview-frame {
    max-width: 100%;
    margin-bottom: 0;
    border: 1px dashed #9fb5aa;
    background:
        linear-gradient(45deg, #f4f7f6 25%, transparent 25%),
        linear-gradient(-45deg, #f4f7f6 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f4f7f6 75%),
        linear-gradient(-45deg, transparent 75%, #f4f7f6 75%);
    background-color: #ffffff;
    background-size: 18px 18px;
    background-position: 0 0, 0 9px, 9px -9px, -9px 0;
}

.logo-preview-empty {
    color: #5f6c72;
    font-weight: 700;
}

.section-heading h2 {
    margin: 0 0 6px;
    color: #243b47;
    font-size: 1.15rem;
}

.section-heading p {
    margin: 0;
    color: #8a4b00;
    font-weight: 700;
}

.extra-settings-grid {
    display: grid;
    gap: 10px;
}

.display-settings-grid {
    display: grid;
    gap: 12px;
}

.display-setting-card {
    display: grid;
    gap: 12px;
    padding: 16px;
    border: 1px solid #d8e2dc;
    border-radius: 8px;
    background: #ffffff;
}

.display-setting-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.display-setting-controls strong {
    color: #243b47;
    font-size: 1.02rem;
}

.extra-setting-row {
    display: grid;
    grid-template-columns: 72px minmax(88px, 0.45fr) minmax(220px, 1fr) minmax(88px, 0.45fr);
    gap: 12px;
    align-items: end;
    padding: 14px;
    border: 1px solid #d8e2dc;
    border-radius: 8px;
    background: #ffffff;
}

.extra-setting-index {
    min-height: 46px;
    display: flex;
    align-items: center;
    color: #425159;
    font-weight: 800;
}

.settings-field.compact {
    gap: 6px;
}

.toggle-field {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid #c8d3ce;
    border-radius: 6px;
    background: #fbfdfc;
    cursor: pointer;
    font-weight: 800;
}

.toggle-field input {
    width: 20px;
    height: 20px;
    margin: 0;
    accent-color: #2f7d62;
}

.color-choice-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.color-choice {
    display: grid;
    gap: 4px;
    align-content: center;
    min-height: 76px;
    padding: 12px;
    border: 4px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
    text-align: center;
    box-shadow: 0 6px 16px rgba(31, 41, 51, 0.12);
}

.color-choice.selected {
    border-color: #111827;
    outline: 3px solid #ffffff;
    outline-offset: -7px;
}

.color-choice-name {
    font-size: 1.05rem;
    font-weight: 800;
}

.color-choice-status {
    min-height: 1.3em;
    font-size: 0.88rem;
    font-weight: 800;
}

.custom-color-row {
    display: grid;
    grid-template-columns: 1fr 72px minmax(140px, 180px);
    gap: 12px;
    align-items: center;
    margin-top: 14px;
    padding: 16px;
    border: 1px solid #d8e2dc;
    border-radius: 8px;
    background: #f7faf9;
}

.custom-color-row p {
    margin: 2px 0 0;
    color: #5f6c72;
    font-size: 0.92rem;
    font-weight: 400;
}

.custom-color-row input[type="color"] {
    min-height: 48px;
    padding: 4px;
    cursor: pointer;
}

.custom-color-row input[type="text"] {
    min-height: 48px;
    text-transform: lowercase;
}

.settings-footer {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    padding-top: 8px;
}

.settings-footer p {
    margin: 0;
    color: #5f6c72;
}

.settings-footer-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.settings-submit {
    min-width: 220px;
    min-height: 52px;
    font-size: 1.05rem;
}

@media (max-width: 640px) {
    .public-page {
        min-height: 100svh;
        padding: 12px;
        place-items: start center;
    }

    .support-card {
        width: 100%;
        max-width: none;
        margin: 0 auto;
        padding: 22px 18px 24px;
        border-top-width: 8px;
        border-radius: 14px;
        box-shadow: 0 10px 26px rgba(31, 95, 139, 0.12);
    }

    .support-header {
        margin-bottom: 22px;
    }

    .form-title,
    .form-title.long-title,
    .form-title.very-long-title {
        font-size: 30px;
        line-height: 1.35;
        letter-spacing: 0;
        white-space: normal;
        word-break: keep-all;
        overflow-wrap: anywhere;
    }

    .support-lead {
        margin-top: 14px;
        font-size: 16px;
        line-height: 1.85;
        text-align: center;
    }

    .support-form {
        gap: 18px;
    }

    .support-field {
        gap: 8px;
        font-size: 17px;
    }

    .support-field input,
    .support-field textarea {
        min-height: 58px;
        padding: 16px;
        font-size: 18px;
    }

    .support-field textarea {
        min-height: 132px;
    }

    .support-check {
        grid-template-columns: 32px 1fr;
        gap: 12px;
        min-height: 72px;
        padding: 16px;
        font-size: 16px;
        line-height: 1.65;
    }

    .support-check input {
        width: 24px;
        height: 24px;
        margin-top: 4px;
    }

    .privacy-box {
        padding: 16px;
        border-left-width: 5px;
    }

    .privacy-box h2 {
        font-size: 16px;
        line-height: 1.5;
    }

    .privacy-box p {
        font-size: 14px;
        line-height: 1.8;
    }

    .support-submit,
    .support-back-button {
        width: 100%;
        min-height: 62px;
        padding: 18px;
        border-radius: 10px;
        font-size: 18px;
    }

    .thanks-card {
        display: grid;
        align-content: center;
        min-height: calc(100svh - 24px);
    }

    .thanks-message {
        margin: 20px 0 28px;
        font-size: 18px;
        line-height: 1.9;
    }

    .panel {
        padding: 24px 18px;
    }

    .admin-header,
    .toolbar,
    .toolbar-actions,
    .search-form,
    .settings-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-actions {
        justify-content: stretch;
    }

    .admin-actions .button,
    .admin-actions form,
    .admin-actions button,
    .settings-footer-actions,
    .settings-footer-actions .button,
    .settings-submit {
        width: 100%;
    }

    .settings-card {
        padding: 18px;
    }

    .color-choice-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .logo-settings-layout {
        grid-template-columns: 1fr;
    }

    .extra-setting-row {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .display-setting-controls,
    .display-setting-controls .toggle-field {
        align-items: stretch;
        flex-direction: column;
    }

    .button,
    .toolbar-actions .button,
    .toolbar-actions button,
    .bulk-select-control,
    .search-form input {
        width: 100%;
    }
}

@media (max-width: 600px) {
    .form-title,
    .form-title.long-title,
    .form-title.very-long-title {
        white-space: normal;
        font-size: 30px;
        line-height: 1.35;
        letter-spacing: 0;
        word-break: keep-all;
        overflow-wrap: anywhere;
    }
}
