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

html {
    height: 100%;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 50%, #90caf9 100%);
    background-attachment: fixed;
    min-height: 100vh;
    height: 100%;
    color: #333;
    line-height: 1.6;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
    overflow-x: hidden;
}

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

.header {
    text-align: center;
    padding: 40px 0;
}

.header h1 {
    font-size: 2.5rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
    margin-bottom: 10px;
    color: #1565c0;
}

.card {
    background: #ffffff;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    color: #333;
    margin-bottom: 20px;
    width: 100%;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.card h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: #1a237e;
}

.card h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: #1a237e;
}

.form-group {
    margin-bottom: 20px;
    width: 100%;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
    max-width: 100%;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: #ffffff;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #1976d2;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    white-space: nowrap;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
}

.btn-primary {
    background: linear-gradient(135deg, #1976d2, #42a5f5);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(33,150,243,0.4);
}

.btn-success {
    background: linear-gradient(135deg, #388e3c, #66bb6a);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76,175,80,0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #d32f2f, #ef5350);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(244,67,54,0.4);
}

.btn-warning {
    background: linear-gradient(135deg, #f57c00, #ffa726);
    color: white;
}

.btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255,152,0,0.4);
}

.alert {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    width: 100%;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.nav-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
    flex-wrap: wrap;
}

.nav-tab {
    padding: 10px 20px;
    background: #f5f5f5;
    border-radius: 8px 8px 0 0;
    text-decoration: none;
    color: #333;
    font-weight: 600;
}

.nav-tab.active {
    background: #1976d2;
    color: white;
}

.event-card {
    background: #f9f9f9;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
    border-left: 4px solid #1976d2;
    width: 100%;
}

.event-card.league {
    border-left-color: #9c27b0;
}

.event-card h3 {
    color: #1976d2;
    margin-bottom: 10px;
    word-wrap: break-word;
}

.event-info {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin: 10px 0;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #666;
    word-wrap: break-word;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #8bc34a);
    transition: width 0.3s;
}

.register-btn {
    width: 100%;
    padding: 20px;
    font-size: 1.2rem;
    margin: 20px 0;
    border-radius: 10px;
}

.register-btn.registered {
    background: linear-gradient(135deg, #388e3c, #66bb6a);
}

.register-btn.not-registered {
    background: linear-gradient(135deg, #757575, #9e9e9e);
}

.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    display: table;
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
    white-space: nowrap;
}

.table th {
    background: #f5f5f5;
    font-weight: 600;
}

.badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-war {
    background: #e3f2fd;
    color: #1565c0;
}

.badge-league {
    background: #f3e5f5;
    color: #7b1fa2;
}

.link-box {
    background: #fff3cd;
    padding: 20px;
    border-radius: 12px;
    margin: 15px 0;
    word-break: break-all;
    word-wrap: break-word;
    overflow-wrap: break-word;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    border: 2px dashed #ffc107;
    line-height: 1.8;
    -webkit-user-select: text;
    user-select: text;
}

.link-notice {
    background: #d1ecf1;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 4px solid #17a2b8;
    color: #0c5460;
    font-weight: 600;
}

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

.header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.header-actions h2 {
    margin: 0;
}

.step-indicator {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.step-number {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    color: #666;
}

.step-item.active .step-number {
    background: linear-gradient(135deg, #1976d2, #42a5f5);
    color: white;
}

.step-item.completed .step-number {
    background: linear-gradient(135deg, #388e3c, #66bb6a);
    color: white;
}

.step-label {
    font-size: 0.9rem;
    color: #666;
}

.step-item.active .step-label,
.step-item.completed .step-label {
    color: #1976d2;
    font-weight: 600;
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header {
        padding: 30px 0;
    }
    
    .header h1 {
        font-size: 1.8rem;
    }
    
    .card {
        padding: 20px;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 14px;
        font-size: 16px;
        width: 100%;
    }
    
    .btn {
        padding: 14px 24px;
        font-size: 16px;
        width: 100%;
        text-align: center;
    }
    
    .actions .btn {
        width: 100%;
    }
    
    .nav-tabs {
        flex-wrap: wrap;
    }
    
    .nav-tab {
        flex: 1;
        min-width: 120px;
        text-align: center;
        padding: 10px;
    }
    
    .event-card {
        padding: 15px;
    }
    
    .event-info {
        flex-direction: column;
        gap: 8px;
    }
    
    .register-btn {
        padding: 18px;
        font-size: 1.1rem;
    }
    
    .table {
        font-size: 14px;
    }
    
    .table th,
    .table td {
        padding: 10px 8px;
    }
    
    .step-indicator {
        gap: 15px;
        flex-wrap: wrap;
    }
    
    .step-item {
        flex: 1;
        min-width: 80px;
    }
    
    .step-number {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .step-label {
        font-size: 0.85rem;
    }
    
    .header-actions {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .header-actions .btn {
        width: 100%;
    }
    
    .link-box {
        font-size: 12px;
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.5rem;
    }
    
    .card {
        padding: 15px;
        border-radius: 10px;
    }
    
    .btn {
        padding: 15px 20px;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    .event-card {
        padding: 12px;
    }
}

@supports (-webkit-touch-callout: none) {
    body {
        cursor: pointer;
    }
    
    .form-group input[type="datetime-local"],
    .form-group input[type="date"],
    .form-group input[type="time"] {
        min-height: 46px;
        padding: 12px 14px;
        font-size: 16px;
        background-color: #ffffff;
    }
    
    .form-group select {
        min-height: 46px;
        background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
        background-repeat: no-repeat;
        background-position: right 12px center;
        background-size: 16px;
        padding-right: 40px;
    }
    
    .btn {
        min-height: 46px;
    }
    
    input, select, textarea {
        font-size: 16px !important;
    }
}
