* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #000000;
    color: #E0E0E0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

input[type="text"] {
    -webkit-user-select: text;
    user-select: text;
}

header {
    background-color: #121212;
    border-bottom: 1px solid #222;
    display: flex;
    justify-content: space-around;
    padding: 8px;
    flex-shrink: 0;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    color: #888;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.tab-btn.active {
    color: #FF9800;
    border-bottom-color: #FF9800;
}

main {
    flex: 1;
    overflow-y: auto;
    position: relative;
}

.tab-content {
    display: none;
    min-height: 100%;
    flex-direction: column;
    padding: 15px;
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
}

.tab-content.active {
    display: flex;
}

/* ===== シングル ===== */
.single-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 450px;
    margin: 0 auto;
    width: 100%;
    min-height: 100%;
}

.single-timer-card {
    background-color: #121212;
    border-radius: 16px;
    padding: 25px 15px;
    text-align: center;
    border: 1px solid #222;
    flex-shrink: 0;
}

.single-time-display {
    font-size: 48px;
    font-weight: bold;
    color: #FFF;
    font-variant-numeric: tabular-nums;
    margin: 8px 0;
    letter-spacing: 1px;
}

.single-time-display .ms-part {
    font-size: 26px;
    color: #FF9800;
}

.single-controls {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 15px;
}

.round-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: none;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.round-btn:active {
    opacity: 0.8;
}

.btn-big-start { background-color: #2E7D32; color: #81C784; }
.btn-big-pause { background-color: #E65100; color: #FFB74D; }
.btn-big-lap { background-color: #1E1E1E; color: #AAA; border: 1px solid #333; }
.btn-big-lap:disabled { opacity: 0.3; cursor: default; }
.btn-big-reset { background-color: #1E1E1E; color: #E57373; border: 1px solid #333; }
.btn-big-reset:disabled { opacity: 0.3; cursor: default; }

.laps-card {
    background-color: #121212;
    border-radius: 16px;
    border: 1px solid #222;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.laps-header {
    padding: 12px 16px;
    font-size: 13px;
    color: #888;
    border-bottom: 1px solid #222;
    display: flex;
    justify-content: space-between;
    flex-shrink: 0;
}

.laps-list {
    overflow-y: auto;
    flex: 1;
}

.lap-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #1A1A1A;
    font-size: 15px;
    font-variant-numeric: tabular-nums;
}

.lap-row:last-child {
    border-bottom: none;
}

.lap-row.fastest .lap-diff {
    color: #4CAF50;
}

.lap-row.slowest .lap-diff {
    color: #E57373;
}

.lap-num {
    color: #888;
    width: 55px;
    flex-shrink: 0;
}

.lap-diff {
    color: #EEE;
    flex: 1;
    text-align: left;
    padding-left: 10px;
}

.lap-total {
    color: #666;
    flex-shrink: 0;
}

/* ===== マルチ ===== */
.multi-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 450px;
    margin: 0 auto;
    width: 100%;
    min-height: 100%;
}

.add-sw-card {
    background-color: #121212;
    border-radius: 16px;
    border: 1px solid #222;
    padding: 15px;
    display: flex;
    gap: 10px;
}

.label-input {
    flex: 1;
    padding: 10px;
    background-color: #1E1E1E;
    border: 1px solid #333;
    border-radius: 8px;
    color: #FFF;
    font-size: 14px;
}

.label-input:focus {
    outline: none;
    border-color: #FF9800;
}

.add-btn {
    padding: 10px 20px;
    background-color: #FF9800;
    color: #000;
    border: none;
    border-radius: 10px;
    font-weight: bold;
    font-size: 15px;
    cursor: pointer;
    white-space: nowrap;
}

.add-btn:active {
    opacity: 0.8;
}

.sw-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sw-card {
    background-color: #121212;
    border-radius: 16px;
    padding: 15px;
    border: 1px solid #222;
}

.sw-card-top {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.sw-label-input {
    flex: 1;
    padding: 8px 10px;
    background-color: #1E1E1E;
    border: 1px solid #333;
    border-radius: 8px;
    color: #FFB74D;
    font-size: 14px;
    font-weight: bold;
}

.sw-label-input:focus {
    outline: none;
    border-color: #FF9800;
}

.sw-card-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sw-time-text {
    font-size: 26px;
    font-weight: 300;
    font-variant-numeric: tabular-nums;
    color: #FFF;
}

.sw-time-text .ms-part {
    font-size: 15px;
    color: #FF9800;
}

.sw-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sm-circle-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFF;
}

.btn-start { background-color: #2E7D32; color: #81C784; }
.btn-pause { background-color: #E65100; color: #FFB74D; }
.btn-reset { background-color: #222; color: #AAA; }
.btn-delete { background-color: transparent; color: #E57373; font-size: 16px; border: 1px solid #333; width: 30px; height: 30px; }

.empty-msg {
    text-align: center;
    color: #555;
    padding: 30px 0;
    font-size: 14px;
}

/* ========================================
   Fixed Advertisement
======================================== */

.ad-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #121212;
    z-index: 1000;
    padding-top: 1px;
    padding-bottom: calc(1px + env(safe-area-inset-bottom));
    border-top: 1px solid #333;
}

/* ========================================
   Footer Link (MRS TOOLS)
======================================== */

.footer-link-container {
    width: 100%;
    margin-top: 24px;
    margin-bottom: 12px;
    text-align: center;
}

.btn-footer-link {
    display: inline-block;
    color: #888888;
    font-size: 0.85rem;
    font-weight: normal;
    text-decoration: underline;
    background: none;
    border: none;
    border-radius: 0;
    min-height: auto;
    padding: 4px 8px;
    transition: color 0.2s;
}

.btn-footer-link:active,
.btn-footer-link:hover {
    color: #cccccc;
    background-color: transparent;
    transform: none;
}