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

html, body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Helvetica, "Microsoft YaHei", sans-serif;
    background: linear-gradient(160deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: #e8e8e8;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.app {
    width: 100%;
    max-width: 480px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 16px;
}

/* 竖屏优先：桌面端较窄列，移动端全宽 */
@media (min-width: 600px) and (orientation: portrait) {
    .app { max-width: 520px; }
}

/* 横屏短高时仍保持单列窄宽，便于竖屏体验 */
@media (orientation: landscape) and (max-height: 500px) {
    .app { max-width: 460px; margin: 0 auto; }
}

/* Header */
.header {
    text-align: center;
    padding: 24px 0 16px;
}

.title {
    font-size: 26px;
    font-weight: 700;
    background: linear-gradient(90deg, #e94560, #f5a623);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 2px;
}

.subtitle {
    font-size: 13px;
    color: #8a8fa3;
    margin-top: 6px;
}

/* Main */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Tabs */
.tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 4px;
    gap: 4px;
}

.tab {
    flex: 1;
    padding: 10px 0;
    background: transparent;
    border: none;
    color: #8a8fa3;
    font-size: 14px;
    font-weight: 500;
    border-radius: 9px;
    cursor: pointer;
    transition: all .2s ease;
    font-family: inherit;
}

.tab.active {
    background: linear-gradient(135deg, #e94560, #f5a623);
    color: #fff;
    box-shadow: 0 4px 12px rgba(233, 69, 96, 0.3);
}

/* Form */
.form-panel {
    display: none;
    flex-direction: column;
    gap: 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 18px;
}

.form-panel.active {
    display: flex;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.label {
    font-size: 13px;
    color: #b8bdc9;
    padding-left: 2px;
}

.input {
    width: 100%;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 12px 14px;
    color: #fff;
    font-size: 15px;
    transition: border-color .2s ease, background .2s ease;
    font-family: inherit;
}

.input:focus {
    outline: none;
    border-color: #e94560;
    background: rgba(0, 0, 0, 0.35);
}

.input::placeholder {
    color: #5b6072;
}

.textarea {
    resize: vertical;
    min-height: 70px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 13px;
    word-break: break-all;
}

/* Buttons */
.btn {
    border: none;
    border-radius: 10px;
    padding: 13px 16px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform .15s ease, opacity .2s ease;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, #e94560, #f5a623);
    color: #fff;
    box-shadow: 0 4px 14px rgba(233, 69, 96, 0.35);
}

.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #e8e8e8;
}
.btn-secondary:active { transform: scale(0.98); }

.link-btn {
    background: transparent;
    border: none;
    color: #e94560;
    font-size: 13px;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
}

/* Saved accounts */
.saved {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 14px 16px;
}

.saved-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.saved-title {
    font-size: 13px;
    color: #b8bdc9;
    font-weight: 600;
}

.saved-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.saved-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 10px 12px;
}

.saved-item-info {
    flex: 1;
    min-width: 0;
}

.saved-item-name {
    font-size: 14px;
    color: #fff;
    font-weight: 500;
    word-break: break-all;
}

.saved-item-time {
    font-size: 11px;
    color: #6c7080;
    margin-top: 2px;
}

.saved-item-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.saved-item-btn {
    border: none;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
}

.saved-item-btn.use {
    background: rgba(245, 166, 35, 0.2);
    color: #f5a623;
}

.saved-item-btn.del {
    background: rgba(255, 255, 255, 0.08);
    color: #8a8fa3;
}

/* Result */
.result {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(233, 69, 96, 0.3);
    border-radius: 16px;
    padding: 16px;
}

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

.result-title {
    font-size: 14px;
    font-weight: 600;
    color: #f5a623;
}

.result-status {
    font-size: 12px;
    color: #4ade80;
}

.result-url {
    background: rgba(0, 0, 0, 0.35);
    border-radius: 10px;
    padding: 12px;
    font-size: 12px;
    color: #b8bdc9;
    word-break: break-all;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    max-height: 140px;
    overflow-y: auto;
    margin-bottom: 10px;
}

.result-meta {
    font-size: 11px;
    color: #6c7080;
    margin-bottom: 12px;
    word-break: break-all;
}

.result-actions {
    display: flex;
    gap: 10px;
}

.result-actions .btn {
    flex: 1;
}

/* Error */
.error {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: 12px;
    padding: 12px 14px;
    color: #f87171;
    font-size: 13px;
    word-break: break-all;
}

/* Loading */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px;
    color: #8a8fa3;
    font-size: 13px;
}

.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: #e94560;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Footer */
.footer {
    text-align: center;
    font-size: 11px;
    color: #4a4f60;
    padding: 16px 0 8px;
}
