/* ========================================
   体育記録帳（カルーセル式）スタイル
   簡単！ICT活用 ブランドカラー適用
======================================== */

/* リセット・基本設定 */
.pe-record-carousel-root {
    all: initial;
    display: block;
    font-family: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', sans-serif;
    background: #FFFFFF;
    color: #2C3E50;
    max-width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
    -webkit-user-select: none;
    user-select: none;
    
    /* ブランドカラー変数 */
    --base: #FFFFFF;
    --base-light: #FAFAFA;
    --base-dark: #F5F5F5;
    --main: #1e3a5f;
    --main-light: #2d5a8f;
    --main-dark: #0f1e3a;
    --accent: #d4af37;
    --accent-light: #f4cf5f;
    --accent-dark: #b8941f;
    --text: #2C3E50;
    --text-light: #7F8C8D;
    --border: #E8E8E8;
    --shadow: 0 4px 20px rgba(30, 58, 95, 0.1);
    --shadow-hover: 0 8px 30px rgba(30, 58, 95, 0.15);
}

.pe-record-carousel-root * {
    box-sizing: border-box;
}

/* ヘッダー */
.pe-header {
    background: var(--main);
    border-top: 3px solid var(--accent);
    border-bottom: 3px solid var(--accent);
    border-radius: 20px;
    padding: 15px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(30, 58, 95, 0.3);
    position: relative;
}

.pe-header h1 {
    font-size: 18px;
    margin: 0 0 8px 0;
    color: #ffffff;
    font-weight: 900;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.pe-sport-selector {
    padding: 8px 15px;
    border-radius: 20px;
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
}

/* タブナビゲーション */
.pe-tab-nav {
    display: flex;
    background: var(--base);
    border-bottom: 2px solid var(--border);
}

.pe-tab-btn {
    flex: 1;
    padding: 15px;
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    font-family: inherit;
    font-weight: 600;
}

.pe-tab-btn.active {
    color: var(--main);
    border-bottom: 3px solid var(--accent);
    font-weight: 900;
}

.pe-tab-content {
    display: none;
}

.pe-tab-content.active {
    display: block;
}

/* カルーセル */
.pe-carousel-wrapper {
    display: flex;
    overflow-x: auto;
    padding: 15px 10px;
    gap: 10px;
    background: var(--base-light);
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    border-bottom: 1px solid var(--border);
}

.pe-carousel-wrapper::-webkit-scrollbar {
    height: 4px;
}

.pe-carousel-wrapper::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 2px;
}

.pe-student-card {
    min-width: 90px;
    padding: 12px 8px;
    background: var(--base);
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    border: 2px solid var(--border);
    transition: all 0.3s;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(30, 58, 95, 0.08);
}

.pe-student-card.active {
    border-color: var(--main);
    background: var(--base);
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(30, 58, 95, 0.2);
}

.pe-student-card.completed {
    opacity: 0.6;
    background: var(--base-dark);
}

.pe-card-no {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 4px;
    font-weight: 600;
}

.pe-card-name {
    font-size: 14px;
    font-weight: bold;
    margin: 4px 0;
    white-space: nowrap;
    color: var(--text);
}

.pe-student-card.active .pe-card-name {
    color: var(--main);
    font-weight: 900;
}

.pe-card-lap {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 4px;
}

.pe-student-card.completed .pe-card-lap {
    color: var(--accent);
}

/* 入力画面 */
.pe-input-container {
    max-width: 600px;
    margin: 0 auto;
}

.pe-student-header {
    padding: 20px;
    text-align: center;
    background: var(--base);
    border-bottom: 1px solid var(--border);
}

.pe-lap-indicator {
    font-size: 16px;
    color: var(--accent);
    font-weight: 900;
    margin-bottom: 5px;
}

.pe-student-name {
    font-size: 32px;
    color: var(--main);
    margin-bottom: 8px;
    font-weight: 900;
}

.pe-progress {
    color: var(--text-light);
    font-size: 14px;
    letter-spacing: 2px;
    margin-bottom: 5px;
    font-weight: 600;
}

.pe-previous-record {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 5px;
}

/* ピッカー */
.pe-picker-box {
    display: flex;
    align-items: center;
    background: var(--base);
    padding: clamp(30px, 5vw, 50px) clamp(20px, 4vw, 40px);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(30, 58, 95, 0.1);
    user-select: none;
    -webkit-user-select: none;
    position: relative;
    margin: 20px auto;
    justify-content: center;
    max-width: 90%;
    width: fit-content;
    touch-action: none;
    -webkit-overflow-scrolling: auto;
}

/* 中央を強調する2本の横線 */
.pe-picker-box::before,
.pe-picker-box::after {
    content: "";
    position: absolute;
    left: clamp(20px, 3vw, 40px);
    right: clamp(80px, 12vw, 120px);
    height: 2px;
    background: linear-gradient(90deg, var(--accent-light), var(--accent), var(--accent-light));
    pointer-events: none;
    z-index: 1;
}

.pe-picker-box::before {
    top: clamp(60px, 10vw, 90px);
}

.pe-picker-box::after {
    bottom: clamp(60px, 10vw, 90px);
}

#pePickerContainer {
    display: flex;
    align-items: center;
    gap: clamp(3px, 1vw, 8px);
    justify-content: center;
    touch-action: none;
}

.pe-wheel {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: clamp(50px, 10vw, 80px);
    margin: 0 clamp(2px, 0.5vw, 5px);
    z-index: 2;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
}

.pe-wheel-value {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    cursor: pointer;
    width: 100%;
    font-weight: 900;
    -webkit-tap-highlight-color: transparent;
}

.pe-wheel-value.side {
    height: clamp(35px, 7vw, 50px);
    font-size: clamp(16px, 3vw, 22px);
    color: var(--text-light);
    font-weight: 400;
}

.pe-wheel-value.side:active {
    color: var(--main);
    transform: scale(1.1);
}

.pe-wheel-value.side:hover {
    color: var(--main-light);
}

.pe-wheel-value.selected {
    height: clamp(60px, 12vw, 90px);
    font-size: clamp(40px, 8vw, 64px);
    color: var(--main);
    font-weight: 900;
    cursor: default;
}

.pe-separator {
    font-size: clamp(28px, 6vw, 44px);
    color: var(--main);
    font-weight: 900;
    padding: 0 clamp(3px, 0.8vw, 8px);
    z-index: 2;
    margin-top: clamp(18px, 4vw, 30px);
}

.pe-unit {
    font-size: clamp(20px, 4vw, 32px);
    font-weight: 900;
    color: var(--main);
    margin-left: clamp(8px, 2vw, 18px);
    padding-top: clamp(18px, 4vw, 30px);
    z-index: 2;
}

/* ボタンエリア */
.pe-button-area {
    padding: 20px;
    background: var(--base);
    border-top: 1px solid var(--border);
}

.pe-all-buttons {
    display: grid;
    grid-template-columns: 1fr 1.5fr 1fr;
    gap: 10px;
}

@media (max-width: 600px) {
    .pe-all-buttons {
        grid-template-columns: 1fr;
    }
}

.pe-btn {
    padding: 16px;
    border: none;
    border-radius: 14px;
    font-weight: 900;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
}

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

.pe-btn-prev {
    background: var(--base);
    color: var(--main);
    border: 2px solid var(--main);
    box-shadow: 0 2px 8px rgba(30, 58, 95, 0.1);
}

.pe-btn-prev:hover {
    background: var(--main);
    color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(30, 58, 95, 0.3);
}

.pe-btn-prev:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
}

.pe-btn-next {
    background: linear-gradient(135deg, var(--main-light) 0%, var(--main) 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(30, 58, 95, 0.3);
}

.pe-btn-next:hover {
    background: linear-gradient(135deg, var(--main) 0%, var(--main-dark) 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(30, 58, 95, 0.4);
}

.pe-btn-skip {
    background: linear-gradient(135deg, #ffb74d 0%, #ff9800 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.3);
}

.pe-btn-skip:hover {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(255, 152, 0, 0.4);
}

/* 完了画面 */
.pe-complete-screen {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 40px 20px;
    min-height: 400px;
    background: var(--base);
}

.pe-complete-screen.active {
    display: flex;
}

.pe-complete-icon {
    font-size: 80px;
    margin-bottom: 20px;
}

.pe-complete-text {
    font-size: 24px;
    font-weight: 900;
    margin-bottom: 10px;
    color: var(--main);
}

.pe-complete-subtext {
    font-size: 16px;
    color: var(--text-light);
    margin-bottom: 40px;
}

.pe-btn-next-lap,
.pe-btn-back {
    padding: 15px 40px;
    background: linear-gradient(135deg, var(--accent-light) 0%, var(--accent) 100%);
    color: var(--main-dark);
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 900;
    cursor: pointer;
    margin: 5px;
    font-family: inherit;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pe-btn-next-lap:hover,
.pe-btn-back:hover {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(212, 175, 55, 0.4);
}

/* 設定画面 */
.pe-settings-content,
.pe-data-content {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    background: var(--base);
}

.pe-settings-section {
    margin-bottom: 30px;
    background: var(--base);
    border: 2px solid var(--border);
    border-radius: 24px;
    padding: 20px;
    box-shadow: var(--shadow);
    position: relative;
}

.pe-settings-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent), var(--accent-light), var(--accent));
    border-radius: 24px 24px 0 0;
}

.pe-settings-section h2 {
    font-size: 18px;
    color: var(--main);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border);
    font-weight: 900;
    display: flex;
    align-items: center;
    gap: 10px;
}

.pe-settings-section h2::before {
    content: '';
    width: 6px;
    height: 24px;
    background: var(--accent);
    border-radius: 3px;
}

.pe-input-group {
    margin-bottom: 15px;
}

.pe-input-group label {
    display: block;
    font-size: 14px;
    color: var(--text);
    margin-bottom: 5px;
    font-weight: 600;
}

.pe-input-group input,
.pe-input-group select,
.pe-input-group textarea {
    width: 100%;
    padding: 12px;
    background: var(--base);
    border: 2px solid var(--border);
    border-radius: 16px;
    font-size: 16px;
    color: var(--text);
    font-family: inherit;
    font-weight: 600;
    outline: none;
    transition: all 0.3s ease;
}

.pe-input-group input:focus,
.pe-input-group select:focus,
.pe-input-group textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.15);
    transform: scale(1.02);
}

.pe-input-group input:hover,
.pe-input-group select:hover,
.pe-input-group textarea:hover {
    border-color: var(--main-light);
}

.pe-input-group textarea {
    min-height: 200px;
    resize: vertical;
    line-height: 1.5;
}

.pe-input-mode-toggle {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.pe-mode-btn {
    flex: 1;
    padding: 10px;
    background: var(--base);
    border: 2px solid var(--border);
    border-radius: 14px;
    color: var(--text);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    font-weight: 900;
}

.pe-mode-btn:hover {
    border-color: var(--accent);
    background: #fffcf5;
    transform: translateY(-2px);
}

.pe-mode-btn.active {
    background: var(--main);
    color: var(--accent);
    border-color: var(--main);
    box-shadow: 0 4px 12px rgba(30, 58, 95, 0.3);
}

.pe-input-area {
    display: none;
}

.pe-input-area.active {
    display: block;
}

.pe-hint-text {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 5px;
}

.pe-student-list {
    margin-top: 15px;
}

.pe-student-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--base-light);
    border-radius: 12px;
    margin-bottom: 8px;
    border: 2px solid var(--border);
    transition: all 0.3s ease;
}

.pe-student-item:hover {
    border-color: var(--main-light);
    box-shadow: 0 2px 8px rgba(30, 58, 95, 0.1);
}

.pe-student-item-no {
    width: 40px;
    font-weight: 900;
    color: var(--accent);
}

.pe-student-item-name {
    flex: 1;
    color: var(--text);
    font-weight: 600;
}

.pe-btn-delete {
    background: linear-gradient(135deg, #e57373 0%, #e74c3c 100%);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    font-weight: 900;
    transition: all 0.3s ease;
}

.pe-btn-delete:hover {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.pe-btn-add {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, var(--accent-light) 0%, var(--accent) 100%);
    color: var(--main-dark);
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 900;
    cursor: pointer;
    margin-top: 10px;
    font-family: inherit;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pe-btn-add:hover {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(212, 175, 55, 0.4);
}

.pe-btn-clear-all {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #e57373 0%, #e74c3c 100%);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 900;
    cursor: pointer;
    margin-top: 10px;
    font-family: inherit;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pe-btn-clear-all:hover {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(231, 76, 60, 0.4);
}

.pe-btn-load {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--main-light) 0%, var(--main) 100%);
    color: #ffffff;
    border: none;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 900;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 4px 12px rgba(30, 58, 95, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pe-btn-load:hover {
    background: linear-gradient(135deg, var(--main) 0%, var(--main-dark) 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(30, 58, 95, 0.4);
}

/* データ一覧 */
.pe-data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    box-shadow: 0 2px 8px rgba(30, 58, 95, 0.08);
    border-radius: 12px;
    overflow: hidden;
}

.pe-data-table th,
.pe-data-table td {
    border: 1px solid var(--border);
    padding: 12px;
    text-align: center;
}

.pe-data-table th {
    background: var(--main);
    color: #ffffff;
    font-weight: 900;
    position: relative;
}

.pe-data-table th::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
}

.pe-data-table tr:nth-child(even) {
    background: var(--base-light);
}

.pe-data-table tr:hover {
    background: #fffcf5;
}

.pe-data-table td {
    color: var(--text);
    font-weight: 600;
}

.pe-btn-export {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, var(--accent-light) 0%, var(--accent) 100%);
    color: var(--main-dark);
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 900;
    cursor: pointer;
    margin-top: 20px;
    font-family: inherit;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pe-btn-export:hover {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(212, 175, 55, 0.4);
}

.pe-btn-clear {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #e57373 0%, #e74c3c 100%);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 900;
    cursor: pointer;
    margin-top: 10px;
    font-family: inherit;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pe-btn-clear:hover {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(231, 76, 60, 0.4);
}

/* レスポンシブ */
@media (max-width: 600px) {
    .pe-student-name {
        font-size: 24px;
    }
    .pe-settings-section {
        padding: 15px;
    }
    .pe-picker-box {
        padding: 25px 15px;
    }
}

@media (max-width: 900px) {
    .pe-header h1 {
        font-size: 16px;
    }
}
