@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;600;700&display=swap');

/* ===== Base / Body ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Roboto', sans-serif;
    background: #ffffff;
    color: #111111;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-size: 18px;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* ===== Main Container ===== */
.container {
    max-width: 920px;
    margin: 40px auto;
    padding: 24px;
    background-color: #ffffff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border-radius: 14px;
    border: 2px solid #333333;
    overflow-x: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

h1 {
    text-align: center;
    margin-bottom: 8px;
    color: #000000;
    font-size: 28px;
    font-weight: 700;
}

.subtitle {
    text-align: center;
    color: #333333;
    margin-bottom: 24px;
    font-size: 16px;
}

/* ===== Network Selector ===== */
.network-selector-section {
    background: #f8f9fa;
    border: 2px solid #333333;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 20px;
}

.network-selector-label {
    font-size: 15px;
    color: #000000;
    margin-bottom: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.network-selector {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.network-btn {
    flex: 1;
    min-width: 180px;
    padding: 14px 20px;
    border: 2px solid #333333;
    border-radius: 10px;
    background: #ffffff;
    color: #111111;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.network-btn:hover {
    border-color: #2563eb;
    color: #2563eb;
    background: #eff6ff;
}

.network-btn.active {
    border-color: #2563eb;
    background: #eff6ff;
    color: #1e40af;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.network-btn-icon {
    font-size: 1.1em;
    color: #2563eb;
}

.testnet-tag {
    font-size: 12px;
    background: #ea580c;
    color: #ffffff;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.network-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    color: #111111;
}

.network-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #16a34a;
    display: inline-block;
    box-shadow: 0 0 6px rgba(22, 163, 74, 0.5);
}

.testnet-badge {
    font-size: 12px;
    background: #ea580c;
    color: #ffffff;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* ===== Contract Address Row ===== */
.contract-address-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding: 10px 14px;
    background: #ffffff;
    border: 2px solid #333333;
    border-left: 4px solid #2563eb;
    border-radius: 8px;
    flex-wrap: wrap;
}

.contract-address-label {
    font-weight: 700;
    color: #1e40af;
    font-size: 15px;
    white-space: nowrap;
}

.contract-address-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.contract-address-value {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 14px;
    color: #000000;
    word-break: break-all;
}

/* ===== Wallet Section ===== */
.wallet-section {
    background: #f8f9fa;
    border: 2px solid #333333;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 24px;
}

.wallet-desc {
    margin: 0 0 12px 0;
    color: #111111;
    font-size: 16px;
}

.wallet-connection {
    margin-bottom: 12px;
}

.connection-help {
    margin-bottom: 16px;
    color: #333333;
    font-size: 15px;
}

.connection-help a {
    color: #2563eb;
    font-weight: 600;
}

.wallet-info {
    margin-top: 16px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
}

.info-item {
    background: #ffffff;
    padding: 14px;
    border-radius: 8px;
    border: 2px solid #333333;
    border-left: 4px solid #2563eb;
}

.info-label {
    font-weight: 700;
    color: #1e40af;
    display: block;
    margin-bottom: 6px;
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.info-value {
    color: #000000;
    word-break: break-all;
    font-size: 17px;
}

.wallet-address-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-copy-address {
    background: none;
    border: 1.5px solid #cbd5e1;
    border-radius: 6px;
    cursor: pointer;
    padding: 4px 6px;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-copy-address:hover {
    background: #e0e7ff;
    border-color: #2563eb;
    color: #2563eb;
}

.btn-copy-address.copied {
    background: #dcfce7;
    border-color: #16a34a;
    color: #16a34a;
}

/* ===== Button Styles ===== */
.btn-connect-wallet {
    padding: 16px 28px;
    font-size: 18px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    background: #16a34a;
    color: #ffffff;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.3);
    font-weight: 700;
}

.btn-connect-wallet:hover {
    background: #15803d;
    box-shadow: 0 4px 16px rgba(22, 163, 74, 0.4);
}

.btn-metamask {
    padding: 14px 20px;
    font-size: 16px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    background: #eab308;
    color: #000000;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(234, 179, 8, 0.3);
    font-weight: 700;
}

.btn-metamask:hover {
    background: #ca8a04;
    box-shadow: 0 4px 16px rgba(234, 179, 8, 0.4);
}

.btn-metamask:disabled {
    background: #713f12 !important;
    color: #fde68a !important;
    border-color: #713f12 !important;
}

.btn-primary {
    background: #2563eb;
    color: #ffffff;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    font-size: 16px;
}

.btn-primary:hover {
    background: #1d4ed8;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
    background: #f0f0f0;
    color: #333333;
    padding: 12px 24px;
    border: 2px solid #999999;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    font-size: 16px;
}

.btn-secondary:hover {
    background: #e0e0e0;
    border-color: #777777;
}

.btn-danger {
    background: #dc2626;
    color: #ffffff;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    font-size: 16px;
}

.btn-danger:hover {
    background: #b91c1c;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}

.btn-warning {
    background: #ea580c;
    color: #ffffff;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 700;
    font-size: 16px;
}

.btn-warning:hover {
    background: #c2410c;
    box-shadow: 0 2px 8px rgba(234, 88, 12, 0.3);
}

.btn-external {
    display: inline-block;
    background: #ffffff;
    color: #2563eb;
    padding: 14px 20px;
    border: 2px solid #2563eb;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.3s;
    margin: 4px;
    font-weight: 600;
    font-size: 16px;
}

.btn-external:hover {
    background: #eff6ff;
}

button:disabled {
    cursor: not-allowed !important;
    opacity: 0.55 !important;
    transform: none !important;
    box-shadow: none !important;
}

button:disabled:hover {
    transform: none !important;
    box-shadow: none !important;
}

.btn-primary:disabled {
    background: #1e3a5f !important;
    color: #a0c4e8 !important;
    border-color: #1e3a5f !important;
}

.btn-danger:disabled {
    background: #7f1d1d !important;
    color: #f8a0a0 !important;
    border-color: #7f1d1d !important;
}

.btn-secondary:disabled {
    background: #d0d0d0 !important;
    color: #777777 !important;
    border-color: #aaaaaa !important;
}

.btn-warning:disabled {
    background: #7c2d12 !important;
    color: #f8b080 !important;
    border-color: #7c2d12 !important;
}

.btn-connect-wallet:disabled {
    background: #14532d !important;
    color: #86efac !important;
    border-color: #14532d !important;
}

/* ===== Category Styles ===== */
.category {
    margin-bottom: 20px;
}

.category-header {
    cursor: pointer;
    padding: 18px;
    background: #ffffff;
    border-radius: 10px;
    transition: all 0.3s;
    margin-bottom: 0;
    color: #000000;
    border: 2px solid #333333;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 18px;
    flex-wrap: wrap;
}

.category-header:hover {
    background: #f0f0f0;
    border-color: #111111;
}

.toggle-icon {
    margin-left: auto;
    color: #2563eb;
    font-size: 1.2em;
}

.category-desc {
    font-size: 14px;
    color: #333333;
    font-weight: 400;
    margin-left: auto;
    margin-right: 10px;
}

.category-content {
    padding: 20px;
    border-left: 2px solid #333333;
    border-right: 2px solid #333333;
    border-bottom: 2px solid #333333;
    border-radius: 0 0 10px 10px;
    background: #ffffff;
    display: none;
}

/* ===== Highlighted Category ===== */
.category-highlighted .category-header {
    background: #eff6ff;
    border-color: #2563eb;
    border-width: 2px;
    border-left: 5px solid #2563eb;
}

.category-highlighted .category-header:hover {
    background: #dbeafe;
    border-color: #1d4ed8;
    border-left: 5px solid #1d4ed8;
}

.category-highlighted .category-content {
    background: #f8faff;
    border-color: #2563eb;
    border-left: 5px solid #2563eb;
}

/* ===== Danger Category (권한 관리) ===== */
.category-danger .category-header {
    background: #fef2f2;
    border-color: #dc2626;
    border-width: 2px;
    border-left: 5px solid #dc2626;
    color: #991b1b;
}

.category-danger .category-header:hover {
    background: #fee2e2;
    border-color: #b91c1c;
    border-left: 5px solid #b91c1c;
}

.category-danger .category-content {
    background: #fffbfb;
    border-color: #dc2626;
    border-left: 5px solid #dc2626;
}

/* ===== Form Styles ===== */
.form-group {
    margin-bottom: 20px;
    overflow: hidden;
}

.form-label {
    display: block;
    margin-bottom: 10px;
    font-weight: 700;
    color: #000000;
    font-size: 17px;
}

.function-desc {
    color: #333333;
    font-size: 15px;
    margin: 0 0 12px 0;
    line-height: 1.5;
}

.form-input, select.form-input {
    width: 100%;
    padding: 14px;
    border: 2px solid #333333;
    border-radius: 8px;
    margin-bottom: 10px;
    background-color: #ffffff;
    color: #000000;
    transition: all 0.3s;
    font-size: 16px;
    box-sizing: border-box;
}

.form-input:focus, select.form-input:focus {
    border-color: #2563eb;
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.form-input::placeholder {
    color: #555555;
}

select.form-input option {
    background: #ffffff;
    color: #000000;
}

.input-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.form-row {
    margin-bottom: 12px;
}

.form-row label {
    display: block;
    font-size: 15px;
    color: #1e40af;
    font-weight: 600;
    margin-bottom: 4px;
}

.input-field {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #333333;
    border-radius: 8px;
    margin-bottom: 10px;
    background-color: #ffffff;
    color: #000000;
    font-size: 16px;
    box-sizing: border-box;
    transition: all 0.3s;
}

.input-field:focus {
    border-color: #2563eb;
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

/* ===== Badge Styles ===== */
.required-badge {
    background: #dc2626;
    color: #ffffff;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    margin-left: 8px;
}

.free-badge {
    background: #16a34a;
    color: #ffffff;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    margin-left: 8px;
}

.danger-badge {
    background: #dc2626;
    color: #ffffff;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    margin-left: 8px;
}

.safe-badge {
    background: #f59e0b;
    color: #ffffff;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    margin-left: 8px;
}

.query-badge {
    background: #6b7280;
    color: #ffffff;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    margin-left: 8px;
}

/* ===== Role Warning ===== */
.role-warning {
    background: #fef2f2;
    border: 2px solid #dc2626;
    border-left: 4px solid #dc2626;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 12px;
    color: #991b1b;
    font-size: 15px;
    line-height: 1.6;
}

/* ===== Role Styles ===== */
.wallet-role {
    padding: 8px 12px;
    border-radius: 6px;
    font-weight: 700;
    display: inline-block;
    font-size: 16px;
}

.wallet-role.admin {
    background: #eff6ff;
    border-left: 4px solid #2563eb;
    color: #1e40af;
}

.wallet-role.normal {
    background: #f8f9fa;
    border-left: 4px solid #333333;
    color: #111111;
}

.wallet-role.operator {
    background: #eff6ff;
    border-left: 4px solid #2563eb;
    color: #1e40af;
}

/* ===== Result Display ===== */
.result-display {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 8px;
    border: 2px solid #333333;
    border-left: 4px solid #2563eb;
    margin-top: 10px;
    color: #000000;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    white-space: pre-wrap;
    word-break: break-all;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    font-size: 15px;
    line-height: 1.6;
}

/* ===== Note Styles ===== */
.note {
    background: #eff6ff;
    border-left: 4px solid #2563eb;
    padding: 12px;
    border-radius: 6px;
    margin: 10px 0 0 0;
    color: #1e3a5f;
    font-size: 15px;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    display: block;
    line-height: 1.5;
}

small.note {
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* ===== Lockup Warning ===== */
.lockup-warning {
    background: #fef2f2;
    border: 2px solid #dc2626;
    border-left: 4px solid #dc2626;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.lockup-warning h3 {
    color: #991b1b;
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 18px;
}

.lockup-warning p {
    margin: 8px 0;
    color: #111111;
    font-size: 16px;
}

.lockup-warning ul {
    margin: 8px 0;
    padding-left: 20px;
    color: #111111;
    font-size: 16px;
}

.lockup-warning li {
    margin-bottom: 4px;
}

.lockup-tip {
    color: #333333 !important;
    font-style: italic;
}

/* ===== Explorer Links ===== */
.explorer-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

/* ===== Wallet Loading Indicator ===== */
.wallet-loading {
    background: #fffbeb;
    border: 2px solid #ea580c;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 15px;
    text-align: center;
}

.wallet-loading h3 {
    color: #c2410c;
    margin: 0 0 8px 0;
    font-size: 18px;
}

.wallet-loading p {
    color: #9a3412;
    margin: 0;
    font-size: 16px;
}

/* ===== Batch Row ===== */
.batch-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.batch-row .row-num {
    min-width: 36px;
    text-align: center;
    font-weight: 700;
    color: #1e40af;
    font-size: 15px;
}

.batch-row input {
    flex: 1;
}

.batch-row input:first-of-type {
    flex: 2;
}

.batch-info {
    color: #333333;
    font-size: 15px;
}

/* ===== Batch Preview Table ===== */
.batch-preview-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.batch-preview-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 15px;
}

.batch-preview-table th,
.batch-preview-table td {
    border: 2px solid #333333;
    padding: 10px 12px;
    text-align: left;
}

.batch-preview-table th {
    background: #f0f0f0;
    font-weight: 700;
    color: #1e40af;
}

.batch-preview-table td {
    color: #111111;
}

/* ===== Utility ===== */
.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

a {
    color: #2563eb;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
    color: #1d4ed8;
}

/* ===== Header ===== */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #333333;
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: #ffffff;
    border: 2px solid #333333;
    border-radius: 14px;
    max-width: 520px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    max-height: 90vh;
    overflow-y: auto;
    margin: auto;
    flex-shrink: 0;
}

.modal-content.modal-danger {
    border-color: #dc2626;
    box-shadow: 0 10px 40px rgba(220, 38, 38, 0.1);
}

.modal-header {
    padding: 20px 24px 0;
}

.modal-header h3 {
    margin: 0;
    color: #000000;
    font-size: 20px;
    font-weight: 700;
}

.modal-danger .modal-header h3 {
    color: #dc2626;
}

.modal-body {
    padding: 16px 24px;
}

.modal-message {
    color: #111111;
    font-size: 16px;
    line-height: 1.7;
    white-space: pre-wrap;
    margin: 0;
    font-family: 'Roboto', sans-serif;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 16px;
    border: 2px solid #333333;
}

.modal-danger .modal-message {
    border-color: #dc2626;
    background: #fef2f2;
}

.modal-footer {
    padding: 16px 24px 20px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-cancel {
    padding: 12px 24px;
    font-size: 16px;
}

.modal-confirm {
    padding: 12px 28px;
    font-size: 16px;
    font-weight: 700;
}

/* ===== Footer ===== */
footer {
    color: #333333;
    font-size: 15px;
}

/* ===== Responsive Design ===== */

/* -- Tablet & small desktop -- */
@media (max-width: 768px) {
    .container {
        margin: 10px;
        padding: 14px;
        border-radius: 10px;
    }

    h1 {
        font-size: 22px;
    }

    .subtitle {
        font-size: 14px;
        margin-bottom: 16px;
    }

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

    .category-desc {
        display: none;
    }

    .category-header {
        padding: 14px;
        font-size: 16px;
        gap: 6px;
    }

    .category-content {
        padding: 14px;
    }

    .btn-connect-wallet {
        width: 100%;
        padding: 14px;
        font-size: 17px;
    }

    .btn-metamask {
        width: 100%;
        font-size: 15px;
        padding: 12px 16px;
    }

    .input-group {
        flex-direction: column;
    }

    .form-input, select.form-input {
        width: 100%;
    }

    .form-label {
        font-size: 16px;
    }

    .function-desc {
        font-size: 14px;
    }

    .explorer-links {
        flex-direction: column;
    }

    .btn-external {
        width: 100%;
        text-align: center;
        padding: 12px 16px;
    }

    .batch-row {
        flex-wrap: wrap;
        gap: 6px;
    }

    .batch-row .row-num {
        min-width: 28px;
        font-size: 13px;
    }

    .batch-row input {
        min-width: 0;
        font-size: 14px;
    }

    .network-selector {
        flex-direction: column;
    }

    .network-btn {
        min-width: auto;
        padding: 12px 16px;
        font-size: 15px;
    }

    .main-header {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }

    .modal-content {
        margin: 10px;
        max-height: 85vh;
        border-radius: 12px;
    }

    .modal-header {
        padding: 16px 18px 0;
    }

    .modal-header h3 {
        font-size: 18px;
    }

    .modal-body {
        padding: 12px 18px;
    }

    .modal-message {
        font-size: 14px;
        padding: 12px;
    }

    .modal-footer {
        padding: 12px 18px 16px;
        flex-wrap: wrap;
    }

    .modal-footer button {
        flex: 1;
        min-width: 100px;
    }

    .contract-address-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        padding: 10px 12px;
    }

    .contract-address-label {
        font-size: 13px;
    }

    .contract-address-value {
        font-size: 12px;
    }

    .wallet-section {
        padding: 14px;
    }

    .wallet-connection {
        flex-direction: column;
    }

    .info-item {
        padding: 10px;
    }

    .info-label {
        font-size: 13px;
    }

    .info-value {
        font-size: 15px;
    }

    .wallet-role {
        font-size: 14px;
    }

    .result-display {
        font-size: 13px;
        padding: 12px;
    }

    .note {
        font-size: 13px;
        padding: 10px;
    }

    .lockup-warning {
        padding: 12px;
    }

    .lockup-warning h3 {
        font-size: 16px;
    }

    .lockup-warning p,
    .lockup-warning ul {
        font-size: 14px;
    }

    .role-warning {
        font-size: 13px;
        padding: 10px 12px;
    }

    .btn-primary,
    .btn-secondary,
    .btn-danger,
    .btn-warning {
        padding: 10px 18px;
        font-size: 15px;
        width: 100%;
        text-align: center;
    }

    .toast {
        left: 16px;
        right: 16px;
        bottom: 16px;
        font-size: 14px;
        padding: 12px 18px;
        text-align: center;
    }

    .network-selector-section {
        padding: 12px;
    }

    .batch-preview-table {
        font-size: 13px;
    }

    .batch-preview-table th,
    .batch-preview-table td {
        padding: 6px 8px;
    }

    footer {
        font-size: 13px;
    }
}

/* -- Mobile phones -- */
@media (max-width: 480px) {
    body {
        font-size: 16px;
    }

    .container {
        margin: 6px;
        padding: 10px;
        border-radius: 8px;
        border-width: 1px;
    }

    h1 {
        font-size: 19px;
    }

    .category-header {
        padding: 12px;
        font-size: 15px;
        gap: 4px;
    }

    .toggle-icon {
        font-size: 1em;
    }

    .category-content {
        padding: 10px;
        border-width: 1px;
    }

    .form-label {
        font-size: 15px;
    }

    .form-input, select.form-input {
        padding: 12px;
        font-size: 15px;
    }

    .btn-primary,
    .btn-secondary,
    .btn-danger,
    .btn-warning {
        padding: 12px 16px;
        font-size: 15px;
    }

    .btn-connect-wallet {
        padding: 12px;
        font-size: 16px;
    }

    .network-btn {
        padding: 10px 14px;
        font-size: 14px;
    }

    .info-grid {
        gap: 8px;
    }

    .info-item {
        padding: 8px 10px;
    }

    .info-label {
        font-size: 12px;
        margin-bottom: 4px;
    }

    .info-value {
        font-size: 14px;
    }

    .modal-content {
        margin: 6px;
        border-radius: 10px;
    }

    .modal-header h3 {
        font-size: 16px;
    }

    .modal-message {
        font-size: 13px;
    }

    .batch-row {
        gap: 4px;
    }

    .batch-row input {
        font-size: 13px;
        padding: 8px;
    }

    .batch-row .row-num {
        min-width: 24px;
        font-size: 12px;
    }

    .safe-badge,
    .free-badge,
    .danger-badge,
    .query-badge,
    .required-badge {
        font-size: 10px;
        padding: 2px 6px;
    }

    .contract-address-value {
        font-size: 11px;
    }

    .wallet-section {
        padding: 10px;
    }

    .wallet-desc {
        font-size: 14px;
    }

    .result-display {
        font-size: 12px;
        padding: 10px;
    }

    .lockup-warning {
        padding: 10px;
    }

    .lockup-warning h3 {
        font-size: 15px;
    }

    .lockup-warning p,
    .lockup-warning ul {
        font-size: 13px;
    }
}

/* ===== Safe Multisig UI ===== */
/* Safe-routed buttons: visual indicator that action goes through Safe */
.safe-routed {
    position: relative;
}

.safe-routed::after {
    content: "Safe";
    display: inline-block;
    background: #f59e0b;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 6px;
    vertical-align: middle;
    letter-spacing: 0.3px;
}

.safe-extra-badge {
    background: #f59e0b;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    margin-left: 6px;
    white-space: nowrap;
}

.safe-check-value {
    font-weight: 700;
    font-size: 17px;
    padding: 4px 0;
}

.safe-check-value.yes {
    color: #16a34a;
}

.safe-check-value.no {
    color: #dc2626;
}

.safe-check-value.none {
    color: #999;
}

.safe-pending-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.safe-pending-info {
    flex: 1;
    min-width: 200px;
}

.safe-flow-guide {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
    padding: 16px;
    background: #fff;
    border: 2px solid #f59e0b;
    border-radius: 10px;
    flex-wrap: wrap;
}

.safe-flow-step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: #fffbeb;
    border-radius: 8px;
    font-size: 14px;
    color: #92400e;
}

.safe-flow-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #f59e0b;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.safe-flow-arrow {
    font-size: 24px;
    color: #f59e0b;
    font-weight: 700;
}

#safePendingList {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

#safePendingList table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

#safePendingList th,
#safePendingList td {
    border: 1px solid #e5e7eb;
    padding: 10px 12px;
    text-align: left;
}

#safePendingList th {
    background: #fffbeb;
    font-weight: 700;
    color: #92400e;
    font-size: 13px;
}

#safePendingList td {
    color: #111;
    vertical-align: middle;
}

#safePendingList tr:hover {
    background: #fffdf7;
}

@media (max-width: 768px) {
    .safe-flow-guide {
        flex-direction: column;
        padding: 12px;
    }
    .safe-flow-arrow {
        transform: rotate(90deg);
    }
    .safe-flow-step {
        padding: 6px 12px;
        font-size: 13px;
    }
    .safe-flow-num {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }
    .safe-pending-header {
        flex-direction: column;
    }
    .safe-pending-info h3 {
        font-size: 15px;
    }
    .safe-pending-info p {
        font-size: 13px;
    }
    #safePendingList table {
        font-size: 12px;
    }
    #safePendingList th,
    #safePendingList td {
        padding: 6px 8px;
    }
}

/* ===== Safe Transaction Card ===== */
.safe-tx-card {
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 0;
    margin-bottom: 14px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.safe-tx-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.safe-tx-card-top {
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.safe-tx-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.safe-tx-role-tag {
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.3px;
}

.safe-tx-desc {
    font-weight: 700;
    font-size: 16px;
    color: #111;
}

.safe-tx-nonce {
    color: #999;
    font-size: 12px;
    font-family: monospace;
}

.safe-tx-status-badge {
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
}

.safe-tx-status-badge.pending {
    background: #f59e0b;
}

.safe-tx-status-badge.executed {
    background: #10b981;
}

.safe-tx-body {
    padding: 12px 18px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
}

.safe-tx-meta {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.safe-tx-meta-label {
    font-size: 12px;
    color: #888;
    margin-bottom: 2px;
}

.safe-tx-meta-value {
    font-size: 13px;
    color: #333;
    font-family: monospace;
}

.safe-tx-progress {
    margin-top: 10px;
}

.safe-tx-progress-bar {
    height: 8px;
    border-radius: 4px;
    background: #e5e7eb;
    overflow: hidden;
    margin-bottom: 6px;
}

.safe-tx-progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s;
}

.safe-tx-progress-text {
    font-size: 13px;
    font-weight: 700;
    color: #333;
}

.safe-tx-signers {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.safe-tx-signer {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-family: monospace;
    border: 1px solid #e5e7eb;
    background: #fff;
}

.safe-tx-signer.signed {
    border-color: #10b981;
    background: #f0fdf4;
    color: #166534;
}

.safe-tx-signer.not-signed {
    border-color: #fca5a5;
    background: #fef2f2;
    color: #991b1b;
}

.safe-tx-signer.is-me {
    font-weight: 700;
    box-shadow: 0 0 0 2px #f59e0b;
}

.safe-tx-signer-icon {
    font-weight: 700;
    font-size: 14px;
}

.safe-tx-actions {
    padding: 12px 18px;
    background: #f0f0f0;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.safe-tx-actions .btn-execute {
    background: #10b981;
    color: #fff;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.2s;
}

.safe-tx-actions .btn-execute:hover {
    background: #059669;
}

.safe-tx-actions .btn-approve {
    background: #2563eb;
    color: #fff;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.2s;
}

.safe-tx-actions .btn-approve:hover {
    background: #1d4ed8;
}

.safe-tx-actions .status-done {
    color: #10b981;
    font-weight: 700;
    font-size: 14px;
}

.safe-tx-date {
    font-size: 12px;
    color: #888;
    white-space: nowrap;
}

.safe-tx-etherscan {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    background: #eff6ff;
    border: 1px solid #2563eb;
    border-radius: 6px;
    color: #2563eb;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s;
}

.safe-tx-etherscan:hover {
    background: #dbeafe;
    text-decoration: none;
}

.safe-empty-state {
    text-align: center;
    padding: 32px 16px;
    color: #999;
    font-size: 15px;
}

.safe-empty-state-icon {
    font-size: 40px;
    margin-bottom: 8px;
    opacity: 0.4;
}

@media (max-width: 768px) {
    .safe-tx-card-top {
        padding: 10px 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .safe-tx-body {
        padding: 10px 12px;
    }
    .safe-tx-actions {
        padding: 10px 12px;
        flex-direction: column;
        gap: 8px;
    }
    .safe-tx-actions button {
        width: 100%;
    }
    .safe-tx-desc {
        font-size: 14px;
    }
    .safe-tx-title {
        flex-wrap: wrap;
    }
    .safe-tx-meta {
        flex-direction: column;
        gap: 8px;
    }
    .safe-tx-signers {
        gap: 4px;
    }
    .safe-tx-signer {
        font-size: 11px;
        padding: 3px 8px;
    }
    .safe-tx-role-tag {
        font-size: 11px;
    }
    .safe-tx-progress-text {
        font-size: 12px;
    }
}

/* ===== Safe Copy Button ===== */
.safe-copy-btn {
    background: none;
    border: 1.5px solid #cbd5e1;
    border-radius: 6px;
    cursor: pointer;
    padding: 3px 5px;
    color: #64748b;
    margin-left: 4px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    flex-shrink: 0;
}

.safe-copy-btn:hover {
    background: #e0e7ff;
    border-color: #2563eb;
    color: #2563eb;
}

.safe-copy-btn.copied {
    background: #dcfce7;
    border-color: #16a34a;
    color: #16a34a;
}

/* ===== Safe Transaction Detail Button ===== */
.safe-tx-detail-btn {
    background: none;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    cursor: pointer;
    padding: 4px 10px;
    color: #666;
    font-size: 12px;
    transition: all 0.2s;
    white-space: nowrap;
}

.safe-tx-detail-btn:hover {
    background: #f0f0f0;
    border-color: #999;
    color: #333;
}

/* ===== Safe Transaction Params ===== */
.safe-tx-params {
    margin-top: 6px;
    font-size: 13px;
    color: #555;
    line-height: 1.6;
    padding: 6px 10px;
    background: #f3f4f6;
    border-radius: 6px;
    font-family: monospace;
    word-break: break-all;
}

.safe-tx-confirm-time {
    font-size: 10px;
    color: #999;
    margin-left: 4px;
    font-family: sans-serif;
}

/* ===== Animation ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.category-content {
    animation: fadeIn 0.3s ease-in-out;
}

/* ===== Toast Notification ===== */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #2563eb;
    color: #ffffff;
    padding: 16px 28px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    font-size: 16px;
    animation: fadeIn 0.3s ease-in-out;
    transition: opacity 0.3s;
}

/* ===== Wallet Not Connected Tooltip ===== */
.wallet-not-connected button:not(.btn-connect-wallet):not(.btn-metamask):not(.network-btn),
.wallet-not-connected .btn-external {
    position: relative;
}

.wallet-not-connected button:not(.btn-connect-wallet):not(.btn-metamask):not(.network-btn):hover::after,
.wallet-not-connected .btn-external:hover::after {
    content: "\BA3C\C800 \C9C0\AC11\C744 \C5F0\ACB0\D558\C138\C694";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #111111;
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 6px;
    white-space: nowrap;
    font-size: 14px;
    margin-bottom: 5px;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border: 1px solid #333333;
}

/* ===== Login Screen ===== */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #f8f9fa;
    z-index: 10000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.login-container {
    max-width: 600px;
    width: 100%;
    background: #ffffff;
    border-radius: 16px;
    padding: 40px 36px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
    border: 2px solid #e5e7eb;
    margin: auto 0;
    flex-shrink: 0;
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-info-box {
    background: #eff6ff;
    border: 2px solid #2563eb;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.login-warning-box {
    background: #fef2f2;
    border: 2px solid #ef4444;
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 24px;
}

.login-network-section {
    margin-bottom: 24px;
}

.login-network-btns {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.login-network-btns .network-btn {
    flex: 1;
    min-width: 180px;
}

.login-wallet-section {
    text-align: center;
}

.login-connect-btn {
    width: 100%;
    font-size: 18px !important;
    padding: 16px 24px !important;
    border-radius: 10px !important;
}

.login-connect-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.login-status {
    margin-top: 12px;
    font-size: 15px;
    min-height: 24px;
    text-align: center;
}

.login-status.error {
    color: #dc2626;
    font-weight: 600;
}

.login-status.success {
    color: #16a34a;
    font-weight: 600;
}

.login-status.loading {
    color: #2563eb;
}

@media (max-width: 640px) {
    .login-screen {
        padding: 12px;
    }

    .login-container {
        padding: 20px 16px;
        border-radius: 12px;
    }

    .login-logo h1 {
        font-size: 24px !important;
    }

    .login-logo p {
        font-size: 14px !important;
    }

    .login-info-box {
        padding: 14px;
    }

    .login-info-box h3 {
        font-size: 16px !important;
    }

    .login-info-box p {
        font-size: 13px !important;
    }

    .login-info-box ol {
        font-size: 13px !important;
        padding-left: 16px !important;
        line-height: 1.8 !important;
    }

    .login-warning-box {
        padding: 10px 14px;
    }

    .login-warning-box p {
        font-size: 12px !important;
    }

    .login-network-btns {
        flex-direction: column;
    }

    .login-network-btns .network-btn {
        min-width: auto;
    }

    .login-connect-btn {
        font-size: 16px !important;
        padding: 14px 20px !important;
    }

    .login-network-section label,
    .login-wallet-section label {
        font-size: 14px !important;
    }
}
