:root {
    --bg-color: #f2f2f7;
    --card-bg: rgba(255, 255, 255, 0.85);
    --text-primary: #000000;
    --text-secondary: #8e8e93;
    --accent-color: #007aff;
    --border-color: rgba(60, 60, 67, 0.1);
    --sheet-bg: rgba(242, 242, 247, 0.95);
    --btn-bg: #ffffff;
    --btn-active: #e5e5ea;
    --danger-color: #ff3b30;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #000000;
        --card-bg: rgba(28, 28, 30, 0.85);
        --text-primary: #ffffff;
        --text-secondary: #98989d;
        --accent-color: #0a84ff;
        --border-color: rgba(84, 84, 88, 0.3);
        --sheet-bg: rgba(28, 28, 30, 0.95);
        --btn-bg: #1c1c1e;
        --btn-active: #2c2c2e;
        --danger-color: #ff453a;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
}

body {
    min-height: 100vh;
    background: var(--bg-color);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: hidden;
    transition: background 0.3s ease;
}

.glow {
    position: absolute;
    width: 300px;
    height: 300px;
    background: var(--accent-color);
    filter: blur(120px);
    opacity: 0.15;
    border-radius: 50%;
    top: 10%;
    left: 10%;
    z-index: 0;
    pointer-events: none;
}

.glow-2 {
    top: auto;
    left: auto;
    bottom: 10%;
    right: 10%;
    background: #5856d6;
}

.card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 340px;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 28px;
    padding: 40px 24px 32px;
    box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255,255,255,0.2);
    text-align: center;
    transform: translateY(0);
    animation: cardIn 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.header-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.2);
    animation: float 3s ease-in-out infinite;
    background: transparent;
}

.header-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 32px;
    line-height: 1.5;
    padding: 0 10px;
}

.subtitle strong {
    color: var(--text-primary);
    font-weight: 600;
}

.trigger-btn {
    width: 100%;
    background: var(--accent-color);
    color: #ffffff;
    font-size: 17px;
    font-weight: 600;
    padding: 16px;
    border-radius: 16px;
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 16px -4px rgba(0, 122, 255, 0.3);
    transition: transform 0.1s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.trigger-btn:active {
    transform: scale(0.96);
    opacity: 0.9;
}

.trigger-btn svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* 新增：添加到主屏幕按钮样式 */
.add-home-btn {
    width: 100%;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    padding: 12px;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    transition: opacity 0.2s;
}
.add-home-btn:active {
    opacity: 0.6;
}

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
    z-index: 10;
}

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

.action-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--sheet-bg);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-radius: 24px 24px 0 0;
    padding: 12px 16px calc(20px + env(safe-area-inset-bottom));
    z-index: 11;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
    display: flex;
    flex-direction: column;
    max-height: 85vh;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.1);
    will-change: transform;
}

.action-sheet.active {
    transform: translateY(0);
}

.drag-area {
    padding: 12px 0 16px;
    cursor: grab;
    display: flex;
    justify-content: center;
    touch-action: none;
}

.drag-area:active {
    cursor: grabbing;
}

.drag-indicator {
    width: 36px;
    height: 5px;
    background: var(--text-secondary);
    opacity: 0.4;
    border-radius: 10px;
    transition: opacity 0.2s;
}

.sheet-header {
    text-align: center;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 12px;
}

.sheet-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.sheet-header p {
    font-size: 12px;
    color: var(--text-secondary);
}

.region-list {
    flex: 1;
    overflow-y: auto;
    border-radius: 14px;
    background: var(--btn-bg);
    margin-bottom: 12px;
    -webkit-overflow-scrolling: touch;
}

.region-list::-webkit-scrollbar {
    display: none;
}

.region-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 16px;
    border: none;
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 17px;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.1s;
    opacity: 0;
    transform: translateY(10px);
}

.region-item:last-child {
    border-bottom: none;
}

.region-item:active {
    background: var(--btn-active);
}

.region-name {
    font-weight: 500;
}

.region-code {
    color: var(--text-secondary);
    font-size: 15px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.action-sheet.active .region-item {
    animation: slideIn 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes slideIn {
    to { opacity: 1; transform: translateY(0); }
}

.cancel-btn {
    width: 100%;
    background: var(--btn-bg);
    color: var(--accent-color);
    font-size: 17px;
    font-weight: 600;
    padding: 16px;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.1s;
}

.cancel-btn:active {
    background: var(--btn-active);
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

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

.modal-box {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    width: 100%;
    max-width: 280px;
    text-align: center;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.modal-overlay.active .modal-box {
    transform: scale(1);
}

.modal-content {
    padding: 24px 20px;
}

.modal-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.modal-desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* 新增：教程步骤文本样式 */
.guide-steps {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}
.guide-steps p {
    margin-bottom: 6px;
}
.guide-steps p:last-child {
    margin-bottom: 0;
}
.guide-steps strong {
    color: var(--text-primary);
}

.modal-btn {
    width: 100%;
    padding: 16px;
    background: transparent;
    border: none;
    border-top: 1px solid var(--border-color);
    color: var(--accent-color);
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.modal-btn:active {
    background: var(--btn-active);
}

.toast {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(0, 0, 0, 0.85);
    color: #ffffff;
    padding: 12px 24px;
    border-radius: 100px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.4s;
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    white-space: nowrap;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}