* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

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

/* ヘッダー */
.header {
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    padding: 0;
}

.header-content {
    max-width: 960px;
    margin: 0 auto;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    text-decoration: none;
}

.logo a {
    color: inherit;
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 24px;
    list-style: none;
}

.nav-links a {
    color: #666;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: #333;
}

/* ヒーローセクション */
.hero {
    text-align: center;
    padding: 60px 20px;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
}

.hero h1 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #333;
}

.hero p {
    font-size: 16px;
    color: #666;
    margin-bottom: 24px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

/* ボタン */
.btn {
    display: inline-block;
    padding: 12px 24px;
    background: #333;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    font-size: 14px;
    transition: background 0.2s;
    border: none;
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.btn:hover {
    background: #555;
}

.btn-primary {
    background: #2563eb;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-secondary {
    background: #fff;
    color: #333;
    border: 1px solid #d0d0d0;
}

.btn-secondary:hover {
    background: #f5f5f5;
}

.btn-danger {
    background: #dc2626;
}

.btn-danger:hover {
    background: #b91c1c;
}

/* カード */
.card {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 20px;
    border: 1px solid #e0e0e0;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #333;
}

/* フォーム */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 14px;
    color: #333;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: #2563eb;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* 景品フォーム */
.prize-item {
    background: #fafafa;
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 12px;
    position: relative;
    border: 1px solid #e0e0e0;
}

.prize-item h4 {
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.remove-prize {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    color: #999;
    border: none;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 18px;
    transition: color 0.2s;
}

.remove-prize:hover {
    color: #dc2626;
}

.add-prize-btn {
    background: #fff;
    color: #333;
    border: 1px dashed #d0d0d0;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: border-color 0.2s;
    width: 100%;
}

.add-prize-btn:hover {
    border-color: #999;
}

/* スクラッチカード */
.scratch-container {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-wrapper {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    border: 1px solid #e0e0e0;
}

.scratch-card {
    position: relative;
    width: 280px;
    height: 380px;
    border-radius: 8px;
    overflow: hidden;
    cursor: crosshair;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    -webkit-touch-callout: none;
    border: 1px solid #e0e0e0;
}

#resultCanvas {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    touch-action: manipulation;
}

#scratchCanvas {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    touch-action: none;
    -webkit-touch-callout: none;
}

/* キャンペーンページ */
.campaign-header {
    text-align: center;
    margin-bottom: 32px;
}

.campaign-thumbnail {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 16px;
}

.campaign-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.info-item {
    text-align: center;
    padding: 16px;
    background: #fafafa;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

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

.info-value {
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.probability-bar {
    background: #e0e0e0;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin: 16px 0;
}

.probability-fill {
    height: 100%;
    background: #2563eb;
    transition: width 0.3s ease;
}

/* 管理画面 */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
    font-size: 14px;
}

.admin-table th,
.admin-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.admin-table th {
    background: #fafafa;
    font-weight: 600;
    color: #333;
}

.admin-table tr:hover {
    background: #fafafa;
}

.winner-badge {
    background: #fef3c7;
    color: #92400e;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

/* アラート */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
}

.alert-info {
    background: #e0f2fe;
    color: #0369a1;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
}

/* 紙吹雪アニメーション */
@keyframes confetti-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

.confetti {
    position: fixed;
    width: 8px;
    height: 8px;
    animation: confetti-fall 4s linear infinite;
    z-index: 9999;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 12px;
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 12px;
    }

    .hero h1 {
        font-size: 24px;
    }

    .hero p {
        font-size: 14px;
    }

    .scratch-card {
        width: 240px;
        height: 320px;
    }

    .card-wrapper {
        padding: 16px;
        width: 90%;
        max-width: 300px;
    }

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

/* ローディングスピナー */
.spinner {
    border: 3px solid #e0e0e0;
    border-left-color: #2563eb;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    animation: spin 0.8s linear infinite;
    margin: 16px auto;
}

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

/* モーダル */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: #fff;
    padding: 24px;
    border-radius: 8px;
    max-width: 480px;
    width: 90%;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #999;
}

.modal-close:hover {
    color: #333;
}

/* フッター */
.footer {
    text-align: center;
    padding: 32px 20px;
    color: #666;
    font-size: 13px;
    border-top: 1px solid #e0e0e0;
    background: #fff;
    margin-top: 40px;
}

/* 機能グリッド */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    margin-top: 16px;
}

.feature-item {
    text-align: center;
    padding: 20px 16px;
}

.feature-icon {
    font-size: 24px;
    margin-bottom: 12px;
    color: #666;
}

.feature-item h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.feature-item p {
    font-size: 13px;
    color: #666;
}

/* リスト */
.simple-list {
    list-style: none;
    padding: 0;
}

.simple-list li {
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

.simple-list li:last-child {
    border-bottom: none;
}

/* ステップ */
.steps {
    counter-reset: step;
}

.steps li {
    position: relative;
    padding-left: 36px;
    padding-bottom: 16px;
    font-size: 14px;
}

.steps li::before {
    counter-increment: step;
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    width: 24px;
    height: 24px;
    background: #f0f0f0;
    border-radius: 50%;
    text-align: center;
    line-height: 24px;
    font-size: 12px;
    font-weight: 600;
    color: #666;
}

/* チェックリスト */
.check-list {
    list-style: none;
    padding: 0;
}

.check-list li {
    padding: 6px 0;
    padding-left: 24px;
    position: relative;
    font-size: 14px;
}

.check-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #16a34a;
    font-weight: 600;
}

/* ルーン文字モード用スタイル */
body.rune-mode {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

body.rune-mode .logo {
    font-size: 14px;
    word-break: break-all;
}

body.rune-mode .nav-links {
    flex-wrap: wrap;
    gap: 8px;
}

body.rune-mode .nav-links a {
    font-size: 12px;
    white-space: nowrap;
}

body.rune-mode .hero h1 {
    font-size: 22px;
    word-break: break-all;
    line-height: 1.4;
}

body.rune-mode .hero p {
    font-size: 14px;
    word-break: break-all;
    line-height: 1.6;
}

body.rune-mode .btn {
    font-size: 12px;
    padding: 10px 16px;
    word-break: break-all;
    white-space: normal;
    text-align: center;
}

body.rune-mode .card-title {
    font-size: 16px;
    word-break: break-all;
    line-height: 1.4;
}

body.rune-mode .form-label {
    font-size: 12px;
    word-break: break-all;
}

body.rune-mode .info-label {
    font-size: 10px;
    word-break: break-all;
}

body.rune-mode .info-value {
    font-size: 16px;
    word-break: break-all;
}

body.rune-mode .feature-item h3 {
    font-size: 13px;
    word-break: break-all;
    line-height: 1.4;
}

body.rune-mode .feature-item p {
    font-size: 11px;
    word-break: break-all;
    line-height: 1.5;
}

body.rune-mode .admin-table {
    font-size: 12px;
}

body.rune-mode .admin-table th,
body.rune-mode .admin-table td {
    padding: 8px 6px;
    word-break: break-all;
}

body.rune-mode .winner-badge {
    font-size: 10px;
    word-break: break-all;
}

body.rune-mode .alert {
    font-size: 12px;
    word-break: break-all;
}

body.rune-mode .footer {
    font-size: 11px;
    word-break: break-all;
}

body.rune-mode .steps li {
    font-size: 12px;
    word-break: break-all;
}

body.rune-mode .simple-list li {
    font-size: 12px;
    word-break: break-all;
}

body.rune-mode h2 {
    word-break: break-all;
    line-height: 1.4;
}

body.rune-mode h3 {
    word-break: break-all;
    line-height: 1.4;
}

body.rune-mode p {
    word-break: break-all;
}

body.rune-mode li {
    word-break: break-all;
}

/* モバイル時のルーンモード調整 */
@media (max-width: 768px) {
    body.rune-mode .logo {
        font-size: 12px;
    }

    body.rune-mode .hero h1 {
        font-size: 18px;
    }

    body.rune-mode .btn {
        font-size: 11px;
        padding: 8px 12px;
    }

    body.rune-mode .card-title {
        font-size: 14px;
    }

    body.rune-mode .nav-links a {
        font-size: 11px;
    }
}
