/* スマホ専用画面のスタイル。
   Bootstrap は読み込まず、この1枚で完結させる */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: #212529;
    background: #fff;
    -webkit-text-size-adjust: 100%;
}

/* ── 固定領域 ── */

/* ヘッダー・次の走行・フィルタをまとめて画面上部に固定する。
   スクロールするのは枠リストだけになる */
.m-top {
    position: sticky;
    top: 0;
    z-index: 20;
    background: #fff;
}

/* ── ヘッダー ── */

.m-header {
    background: #fff;
    border-bottom: 1px solid #dee2e6;
}

.m-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 12px 0;
}

.m-title {
    font-size: 12px;
    color: #6c757d;
}

.m-switch {
    font-size: 12px;
    color: #0d6efd;
    text-decoration: none;
}

.m-header-main {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px 8px;
}

.m-logo {
    display: block;
    border-radius: 4px;
}

.m-event {
    flex: 1;
    min-width: 0;
    font-size: 15px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.m-user {
    flex-shrink: 0;
    font-size: 12px;
    color: #6c757d;
}

.name-editable {
    cursor: pointer;
    text-decoration: underline dotted;
    text-underline-offset: 3px;
}

/* ── 次の走行 ── */

.m-next {
    padding: 10px 12px;
    background: #e7f1ff;
    border-bottom: 1px solid #dee2e6;
}

.m-next-label {
    margin: 0;
    font-size: 11px;
    color: #0a58ca;
}

.m-next-main {
    margin: 2px 0 0;
    font-size: 20px;
    font-weight: 600;
    color: #084298;
}

.m-next-sub {
    margin: 1px 0 0;
    font-size: 12px;
    color: #0a58ca;
}

.m-next.none {
    background: #f8f9fa;
}

.m-next.none .m-next-label,
.m-next.none .m-next-sub {
    color: #6c757d;
}

.m-next.none .m-next-main {
    font-size: 16px;
    font-weight: 500;
    color: #495057;
}

/* ── フィルタ ── */

.m-filters {
    display: flex;
    gap: 6px;
    padding: 8px 12px;
    overflow-x: auto;
    border-bottom: 1px solid #dee2e6;
    -webkit-overflow-scrolling: touch;
}

.m-chip {
    flex-shrink: 0;
    padding: 6px 12px;
    font-size: 13px;
    color: #212529;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 16px;
    cursor: pointer;
}

.m-chip.on {
    color: #084298;
    background: #e7f1ff;
    border-color: #9ec5fe;
}

/* ── 枠リスト ── */

.m-list {
    padding-bottom: 40px;
}

.slot {
    border-bottom: 1px solid #e9ecef;
    /* クラスの色を示す帯。色は .slot.c-red などで指定する */
    border-left: 12px solid transparent;
}

.slot.hidden {
    display: none;
}

.slot-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 8px 12px;
    cursor: pointer;
}

.slot-time {
    font-size: 15px;
    font-variant-numeric: tabular-nums;
}

.slot-class {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    color: #495057;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.slot-status {
    flex-shrink: 0;
    font-size: 12px;
    color: #6c757d;
    white-space: nowrap;
}

/* いま押せない枠は背景を落とす。終了した枠と受付前の枠が対象 */
.slot:not(.editable) {
    background: #f8f9fa;
}

/* 終了した枠は文字も落とす。受付前はこれから使うので落とさない */
.slot.past .slot-time,
.slot.past .slot-class {
    color: #868e96;
}

.slot.mine .slot-status {
    color: #0f6e56;
    font-weight: 600;
}

.slot.open .slot-time {
    font-weight: 600;
}

/* クラスの色。index.css の td.red / td.yellow / td.blue と対応させる */
.slot.c-red {
    border-left-color: rgb(244, 167, 167);
}

.slot.c-yellow {
    border-left-color: rgb(240, 200, 90);
}

.slot.c-blue {
    border-left-color: rgb(133, 175, 233);
}

/* ── レーン一覧 ── */

.lane-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 0 12px 10px;
}

.lane {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 6px 8px;
    font-size: 13px;
    border: 1px solid transparent;
    border-radius: 6px;
}

.lane-no {
    flex-shrink: 0;
    width: 20px;
    font-size: 11px;
    color: #adb5bd;
    text-align: right;
}

.lane-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lane.taken {
    background: #f1f3f5;
}

.lane.empty {
    color: #adb5bd;
    background: #fff;
    border-color: #e9ecef;
}

.lane.mine {
    color: #085041;
    background: #d8f3e8;
    border-color: #7fd0b5;
}

.lane.mine .lane-no {
    color: #0f6e56;
}

/* 予約できる枠だけ押せることを示す */
.slot.editable .lane.empty {
    color: #0d6efd;
    border-color: #9ec5fe;
    cursor: pointer;
}

.slot.editable .lane.mine {
    cursor: pointer;
}

.lane-action {
    margin-left: auto;
    flex-shrink: 0;
    font-size: 11px;
    color: #0f6e56;
}

/* ── 開催日以外の案内 ── */

.event-notice {
    margin: 40px 16px;
    padding: 40px 24px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    text-align: center;
}

.event-notice-date {
    margin: 0 0 10px;
    font-size: 1.3rem;
    font-weight: 700;
}

.event-notice-text {
    margin: 0;
    font-size: 1rem;
    color: #6c757d;
}

/* ── 通知 ── */

.m-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 1100;
    max-width: 88%;
    padding: 10px 16px;
    font-size: 13px;
    color: #fff;
    background: rgba(33, 37, 41, .92);
    border-radius: 8px;
    transform: translateX(-50%);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
}

.m-toast.show {
    opacity: 1;
}

/* ── 名前変更のモーダル ── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1050;
}

.modal-overlay.show {
    display: flex;
}

.modal-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px 20px;
    width: 100%;
    max-width: 360px;
}

.modal-card h5 {
    margin: 0 0 8px;
    font-size: 1.05rem;
}

.modal-note {
    margin: 0 0 14px;
    font-size: .8rem;
    color: #6c757d;
    line-height: 1.6;
}

.modal-card input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    font-size: 1rem;
    border: 1px solid #dee2e6;
    border-radius: 8px;
}

.modal-card input[type="text"]:focus {
    outline: 2px solid #0d6efd;
    outline-offset: -1px;
}

.modal-error {
    margin: 8px 0 0;
    min-height: 1.2em;
    font-size: .82rem;
    color: #dc3545;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

.modal-buttons button {
    flex: 1;
    padding: 10px;
    font-size: .95rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
}

.modal-buttons .btn-ok {
    color: #fff;
    background: #0d6efd;
    border: none;
}

.modal-buttons .btn-cancel {
    color: #212529;
    background: #f0f2f5;
    border: 1px solid #dee2e6;
}
