:root {
    --bg: #f5f7fa;
    --card-bg: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --border: #e5e7eb;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --radius: 12px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.header {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: #fff;
    padding: 40px 0;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 32px;
    flex-wrap: wrap;
}

.header-title {
    text-align: left;
}

.header h1 {
    margin: 0 0 8px;
    font-size: 2.5rem;
}

.subtitle {
    margin: 0;
    opacity: 0.9;
    font-size: 1.1rem;
}

.controls {
    margin: 32px 0 24px;
}

.filter-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.tab {
    padding: 8px 16px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.tab:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 48px;
}

.tool-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.tool-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

.tool-icon {
    font-size: 3rem;
    line-height: 1;
    margin-bottom: 16px;
}

.tool-name {
    margin: 0 0 8px;
    font-size: 1.25rem;
    font-weight: 600;
}

.tool-desc {
    margin: 0 0 16px;
    color: var(--muted);
    font-size: 0.95rem;
    flex: 1;
}

.tool-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.tag {
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 999px;
    background: #eff6ff;
    color: var(--primary);
}

.tag.download {
    background: #f0fdf4;
    color: #16a34a;
}

.tag.online {
    background: #eff6ff;
    color: var(--primary);
}

.tool-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 500;
    transition: background 0.2s;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
}

.tool-link.online {
    background: var(--primary);
    color: #fff;
}

.tool-link.online:hover {
    background: var(--primary-hover);
}

.tool-link.download {
    background: #16a34a;
    color: #fff;
}

.tool-link.download:hover {
    background: #15803d;
}

.empty-state {
    text-align: center;
    padding: 48px 0;
    color: var(--muted);
}

.footer {
    text-align: center;
    padding: 24px 0;
    color: var(--muted);
    font-size: 0.9rem;
    border-top: 1px solid var(--border);
}

.footer a {
    color: var(--primary);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* 意见反馈引导弹窗 */
.fb-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}

.fb-dialog {
    position: relative;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-width: 420px;
    width: 100%;
    padding: 28px 24px;
    text-align: center;
}

.fb-dialog h3 {
    margin: 0 0 12px;
    font-size: 1.25rem;
}

.fb-text {
    margin: 0 0 16px;
    color: var(--text);
    font-size: 0.95rem;
}

.fb-qr {
    width: 160px;
    height: 160px;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 16px;
    background: #fff;
}

.fb-steps {
    margin: 0;
    padding-left: 20px;
    text-align: left;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.8;
}

.fb-close {
    position: absolute;
    top: 10px;
    right: 14px;
    border: none;
    background: none;
    font-size: 1.5rem;
    color: var(--muted);
    cursor: pointer;
    line-height: 1;
}

.fb-close:hover {
    color: var(--text);
}

/* 微信小程序 banner（位于头部蓝色区域内） */
.mp-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: var(--radius);
    max-width: 480px;
}

.mp-banner .mp-qr {
    width: 72px;
    height: 72px;
    border-radius: 8px;
    flex-shrink: 0;
    background: #fff;
}

.mp-banner .mp-info h3 {
    margin: 0 0 4px;
    font-size: 0.95rem;
    color: #fff;
}

.mp-banner .mp-info p {
    margin: 0;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.5;
}

/* 图片压缩/缩放 */
.ir-src-info {
    margin: 10px 0;
    padding: 8px 12px;
    background: var(--bg);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--muted);
}

.ir-size-row {
    align-items: flex-end;
    gap: 16px;
}

.ir-lock {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-bottom: 8px;
    font-size: 0.9rem;
    color: var(--muted);
    white-space: nowrap;
}

.ir-result {
    margin-top: 16px;
    text-align: center;
}

.ir-result img {
    max-width: 100%;
    max-height: 320px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
}

.ir-result div {
    margin-top: 8px;
    font-size: 0.9rem;
    color: var(--muted);
}

/* 颜色选择器 */
.cp-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    align-items: flex-start;
}

.cp-panel, .cp-hue {
    display: block;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: crosshair;
    touch-action: none;
}

.cp-hue {
    margin-top: 10px;
}

.cp-right {
    flex: 1;
    min-width: 260px;
}

.cp-swatch {
    width: 100%;
    height: 56px;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 12px;
}

.cp-row {
    align-items: center;
    gap: 8px;
}

.cp-row label {
    width: 36px;
    flex-shrink: 0;
}

.cp-row input {
    flex: 1;
}

/* SPA tool view */
.tool-view {
    margin-bottom: 48px;
    animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.tool-view-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.back-button {
    padding: 8px 16px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--primary);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.back-button:hover {
    border-color: var(--primary);
    background: #eff6ff;
}

.tool-view-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.tool-view-content {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.tool-intro {
    margin: 0 0 16px;
    color: var(--muted);
}

.tool-panel textarea {
    width: 100%;
    height: 220px;
    padding: 12px;
    font-family: Consolas, "Courier New", monospace;
    font-size: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    resize: vertical;
    outline: none;
}

.tool-panel textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.tool-buttons {
    margin: 16px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.btn {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: var(--primary);
    color: #fff;
    font-size: 0.95rem;
    transition: background 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn:hover {
    background: var(--primary-hover);
}

.btn.secondary {
    background: #6b7280;
}

.btn.secondary:hover {
    background: #4b5563;
}

.btn-success {
    background: #16a34a;
}

.btn-success:hover {
    background: #15803d;
}

.tool-message {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    display: none;
}

.tool-message.success {
    background: #dcfce7;
    color: #166534;
    display: block;
}

.tool-message.error {
    background: #fee2e2;
    color: #991b1b;
    display: block;
}

/* Form rows */
.form-row {
    margin-bottom: 16px;
}

.form-row label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
}

.form-row.inline {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.form-row.inline input {
    flex: 1;
}

.form-row.inline .btn {
    margin: 0;
}

.form-row input[type="text"],
.form-row input[type="number"],
.form-row textarea,
.form-row select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-row input:focus,
.form-row textarea:focus,
.form-row select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-row textarea {
    min-height: 100px;
    resize: vertical;
    font-family: Consolas, "Courier New", monospace;
}

/* Tool output */
.tool-output {
    margin-top: 12px;
    padding: 12px;
    background: #f3f4f6;
    border-radius: 8px;
    font-family: Consolas, "Courier New", monospace;
    font-size: 1rem;
    word-break: break-all;
    min-height: 48px;
}

/* IP query */
.ip-result {
    margin-top: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.ip-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}

.ip-row:last-child {
    border-bottom: none;
}

.ip-row span:first-child {
    color: var(--muted);
    flex-shrink: 0;
}

.ip-row span:last-child {
    text-align: right;
    word-break: break-all;
}

/* QR generator */
.qr-preview {
    text-align: center;
    margin-top: 16px;
}

.qr-preview img {
    max-width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
    background: #fff;
}

/* Password generator */
.password-result {
    font-family: Consolas, "Courier New", monospace;
    font-size: 1.4rem;
    word-break: break-all;
    padding: 16px;
    background: #f3f4f6;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 20px;
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-option {
    margin-bottom: 14px;
}

.password-option label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.length-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}

input[type="range"] {
    width: 100%;
}

.placeholder-panel {
    text-align: center;
    padding: 48px 20px;
    color: var(--muted);
}

.placeholder-panel .placeholder-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

.download-panel {
    text-align: center;
    padding: 32px 20px;
}

.download-panel p {
    color: var(--muted);
    margin-bottom: 24px;
}

.netdisk-version {
    margin-left: 10px;
    font-size: 0.85rem;
    color: var(--muted);
}

.netdisk-code {
    margin-top: 18px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.netdisk-code strong {
    font-size: 1.1rem;
    letter-spacing: 2px;
    color: var(--primary);
    background: #eef2ff;
    padding: 4px 12px;
    border-radius: 6px;
}

.btn-copy {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.netdisk-note {
    margin-top: 16px;
    font-size: 0.85rem;
    color: var(--muted);
}

/* MBTI test */
.mbti-panel {
    max-width: 640px;
    margin: 0 auto;
}

.mbti-intro {
    text-align: center;
    margin-bottom: 24px;
}

.mbti-intro h3 {
    margin: 0 0 8px;
    font-size: 1.5rem;
}

.mbti-intro p {
    color: var(--muted);
    margin: 0;
}

.mbti-start {
    text-align: center;
    padding: 32px 0;
}

.mbti-start p {
    color: var(--muted);
    margin-bottom: 24px;
}

.mbti-progress {
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    margin-bottom: 24px;
    overflow: hidden;
}

.mbti-progress-bar {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s;
}

.mbti-question {
    text-align: center;
}

.mbti-qnum {
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.mbti-qtext {
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: 32px;
    line-height: 1.5;
}

.mbti-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mbti-option {
    width: 100%;
    padding: 14px 20px;
    font-size: 1rem;
}

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

.mbti-card {
    max-width: 420px;
    margin: 0 auto 24px;
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    color: #1f2937;
}

.mbti-card-inner {
    background: rgba(255, 255, 255, 0.92);
    border-radius: var(--radius);
    padding: 28px 20px;
}

.mbti-type {
    font-size: 4rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 12px;
    letter-spacing: 4px;
}

.mbti-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.mbti-desc {
    color: var(--muted);
    margin-bottom: 20px;
    line-height: 1.6;
}

.mbti-brand {
    font-size: 0.8rem;
    color: #9ca3af;
}

.mbti-actions {
    justify-content: center;
}

/* Unit converter */
.unit-panel {
    max-width: 560px;
    margin: 0 auto;
}

.unit-input-row > div {
    width: 100%;
}

.unit-select-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 12px;
    align-items: end;
}

.unit-select-row label {
    margin-bottom: 6px;
}

.unit-select-row select {
    width: 100%;
}

#ucSwap {
    padding: 10px 14px;
    font-size: 1.2rem;
    margin-bottom: 2px;
}

.unit-result {
    margin-top: 20px;
    padding: 16px;
    background: #f3f4f6;
    border-radius: 8px;
    font-size: 1.15rem;
    text-align: center;
    word-break: break-all;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* JSON/XML converter */
.jsonxml-hint {
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

/* Stopwatch */
.stopwatch-panel {
    max-width: 480px;
    margin: 0 auto;
    text-align: center;
}

.stopwatch-display {
    font-family: Consolas, "Courier New", monospace;
    font-size: 4rem;
    font-weight: 700;
    color: var(--text);
    margin: 24px 0;
    letter-spacing: 2px;
}

.stopwatch-buttons {
    justify-content: center;
    margin-bottom: 24px;
}

.stopwatch-laps {
    max-height: 300px;
    overflow-y: auto;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.stopwatch-lap {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    font-family: Consolas, "Courier New", monospace;
    font-size: 1rem;
    color: var(--muted);
}

.stopwatch-lap:last-child {
    border-bottom: none;
}

/* What to eat */
.eat-result {
    margin-top: 24px;
    font-size: 1.9rem;
    font-weight: 700;
    text-align: center;
    color: var(--primary);
    min-height: 48px;
}

.eat-tip {
    margin-top: 8px;
    text-align: center;
    color: var(--muted);
    font-size: 1rem;
}
