/**
 * 样式表 - CoC 调查员车卡生成器
 * 克苏鲁主题样式
 */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;700&display=swap');

/* 全局样式 */
body {
    font-family: 'Noto Serif SC', serif;
}

/* 背景渐变 */
.cosmic-gradient {
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
}

/* 发光文字效果 */
.glow-text {
    text-shadow: 0 0 10px rgba(251, 191, 36, 0.5), 0 0 20px rgba(251, 191, 36, 0.3);
}

/* 输入框样式 */
.input-field {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(251, 191, 36, 0.3);
    transition: all 0.3s ease;
}

.input-field:focus {
    border-color: rgba(251, 191, 36, 0.8);
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.3);
    outline: none;
}

/* 主按钮样式 */
.btn-primary {
    background: linear-gradient(135deg, #b45309 0%, #d97706 50%, #b45309 100%);
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(251, 191, 36, 0.4);
}

/* 卡片容器 */
.card {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(251, 191, 36, 0.2);
}

/* 只读字段样式 */
.readonly-field {
    background: rgba(15, 23, 42, 0.8);
    color: #22d3ee;
    border: 1px solid rgba(34, 211, 238, 0.3);
}

/* 技能点显示区域 */
.skill-points-display {
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.1) 0%, rgba(251, 191, 36, 0.1) 100%);
    border: 2px solid rgba(34, 211, 238, 0.5);
    animation: pulse-glow 3s ease-in-out infinite;
}

/* 脉冲发光动画 */
@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 15px rgba(34, 211, 238, 0.3);
    }
    50% {
        box-shadow: 0 0 25px rgba(34, 211, 238, 0.5);
    }
}

/* 技能标签样式 */
.skill-tag {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.15) 0%, rgba(217, 119, 6, 0.15) 100%);
    border: 1px solid rgba(251, 191, 36, 0.4);
    border-radius: 8px;
    padding: 10px 16px;
    color: #fbbf24;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: default;
}

.skill-tag:hover {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.25) 0%, rgba(217, 119, 6, 0.25) 100%);
    border-color: rgba(251, 191, 36, 0.7);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.3);
}

/* 技能项样式 */
.skill-item {
    transition: all 0.3s ease;
}

.skill-item:hover {
    background: rgba(51, 65, 85, 0.7);
    transform: translateX(4px);
}

/* ==================== 移动端优化 ==================== */

/* 小型手机 (<= 480px) */
@media (max-width: 480px) {
    /* 容器优化 */
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    /* 标题优化 */
    h1 {
        font-size: 1.75rem !important;
        line-height: 1.2;
    }

    h2 {
        font-size: 1.25rem !important;
    }

    /* 输入框触摸优化 */
    input[type="text"],
    input[type="number"],
    select,
    textarea {
        font-size: 16px !important; /* 防止iOS自动缩放 */
        min-height: 48px !important; /* 触摸友好 */
    }

    /* 按钮触摸优化 */
    button {
        min-height: 44px !important;
        font-size: 14px !important;
    }

    /* 卡片内边距 */
    .card {
        padding: 1rem !important;
    }

    /* 技能点数显示 */
    .skill-points-display {
        padding: 0.75rem !important;
    }

    .skill-points-display .text-5xl {
        font-size: 2.5rem !important;
    }

    /* 技能标签 */
    .skill-tag {
        font-size: 0.8125rem;
        padding: 6px 10px;
    }

    /* 技能项 */
    .skill-item {
        font-size: 0.8125rem;
    }

    /* 属性输入框 */
    input[type="number"].text-lg {
        font-size: 1.125rem !important;
        padding: 0.5rem !important;
    }

    /* 弹窗优化 */
    .fixed > div {
        max-height: 95vh !important;
        margin: 1rem !important;
    }
}

/* 手机 (481px - 767px) */
@media (min-width: 481px) and (max-width: 767px) {
    /* 输入框触摸优化 */
    input[type="text"],
    input[type="number"],
    select,
    textarea {
        font-size: 16px !important;
        min-height: 48px !important;
    }

    /* 按钮触摸优化 */
    button {
        min-height: 44px !important;
    }
}

/* 平板竖屏 (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    .skill-points-display {
        padding: 1.25rem;
    }

    .skill-tag {
        font-size: 0.9375rem;
        padding: 9px 14px;
    }
}

/* 触摸设备通用优化 */
@media (hover: none) and (pointer: coarse) {
    /* 增加可点击区域 */
    button,
    a,
    input,
    select,
    .skill-tag {
        min-touch-target-size: 44px 44px;
    }

    /* 移除hover效果,使用active代替 */
    .skill-tag:hover {
        transform: none;
    }

    .skill-tag:active {
        background: linear-gradient(135deg, rgba(251, 191, 36, 0.25) 0%, rgba(217, 119, 6, 0.25) 100%);
        border-color: rgba(251, 191, 36, 0.7);
    }

    .btn-primary:hover {
        transform: none;
    }

    .btn-primary:active {
        transform: scale(0.98);
    }
}

/* 横屏模式优化 */
@media (orientation: landscape) and (max-height: 600px) {
    header {
        margin-bottom: 0.5rem !important;
    }

    header h1 {
        font-size: 1.5rem !important;
    }

    header p {
        font-size: 0.875rem !important;
    }

    .card {
        padding: 0.75rem !important;
    }

    /* 减少垂直间距 */
    .space-y-8 > * + * {
        margin-top: 1rem !important;
    }
}

/* 高分辨率屏幕优化 */
@media (min-width: 1440px) {
    .container {
        max-width: 1280px;
    }

    /* 增大字体 */
    h1 {
        font-size: 3rem !important;
    }

    h2 {
        font-size: 1.875rem !important;
    }

    /* 增大输入框 */
    input, select, textarea {
        font-size: 1.125rem !important;
    }
}

/* 超宽屏优化 */
@media (min-width: 1920px) {
    .container {
        max-width: 1536px;
    }

    body {
        font-size: 1.125rem;
    }
}

/* iOS Safari特定优化 */
@supports (-webkit-touch-callout: none) {
    /* 防止iOS双击缩放 */
    button {
        touch-action: manipulation;
    }

    /* 修复iOS输入框圆角 */
    input[type="text"],
    input[type="number"],
    select,
    textarea {
        border-radius: 8px;
        -webkit-appearance: none;
    }

    /* 修复iOS select箭头 */
    select {
        -webkit-appearance: none;
        appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23fbbf24' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 0.75rem center;
        background-size: 12px;
        padding-right: 2.5rem;
    }
}

/* 滚动优化 */
.smooth-scroll {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* 移动端弹窗滚动优化 */
@media (max-width: 768px) {
    #addWeaponModal .bg-slate-800 {
        max-height: 90vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* 移动端网格布局优化 */
@media (max-width: 640px) {
    /* 属性网格改为2列 */
    .grid-cols-2.md\:grid-cols-3.lg\:grid-cols-5 {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* 衍生数值保持2列 */
    .grid-cols-2.md\:grid-cols-4 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* 安全区域适配 (iPhone X+) */
@supports (padding: env(safe-area-inset-bottom)) {
    body {
        padding-bottom: env(safe-area-inset-bottom);
    }

    /* 底部按钮安全区域 */
    .flex.flex-col.sm\:flex-row {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* 暗黑模式偏好检测 */
@media (prefers-color-scheme: dark) {
    /* 已经是暗黑主题,无需修改 */
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 打印优化 */
@media print {
    body {
        background: white;
        color: black;
    }

    .card {
        background: white;
        border: 1px solid #ccc;
        break-inside: avoid;
    }

    button,
    .bg-black\/70 {
        display: none !important;
    }
}
