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

body {
    font-family: 'Noto Sans JP', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 10px;
    user-select: none;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 10px;
}

h1 {
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 12px;
    align-items: start;
}

@media (max-width: 800px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

.card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    padding: 12px;
}

.card-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.card-title::before {
    content: '';
    width: 3px;
    height: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
}

.time-slots {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-auto-flow: dense;
    gap: 4px;
}

.slot-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.slot-group.left-column {
    grid-column: 1;
}

.slot-group.right-column {
    grid-column: 2;
}

.time-slot {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    background: #f8f9fa;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 2px solid transparent;
}

.time-slot:hover {
    background: #f0f1f3;
}

.time-slot.selected {
    border-color: #667eea;
    background: #ede9fe;
}

.time-slot.cursor {
    outline: 2px solid #333;
    outline-offset: -2px;
    z-index: 1;
}

/* 10分スロット */
.time-slot.level-1 {
    padding: 3px 8px 3px 16px;
    font-size: 0.65rem;
    background: #f0f1f3;
}

.time-slot.level-1.selected {
    background: #ede9fe;
}

/* 1分スロット */
.time-slot.level-2 {
    padding: 2px 8px 2px 28px;
    font-size: 0.55rem;
    background: #e8e9eb;
}

.time-slot.level-2.selected {
    background: #ede9fe;
}

/* 10秒スロット */
.time-slot.level-3 {
    padding: 1px 8px 1px 40px;
    font-size: 0.5rem;
    background: #e0e1e3;
}

.time-slot.level-3.selected {
    background: #ede9fe;
}

.time-label {
    font-size: 0.7rem;
    font-weight: 500;
    color: #666;
    min-width: 75px;
    white-space: nowrap;
}

.time-slot.level-1 .time-label {
    font-size: 0.6rem;
    min-width: 65px;
}

.time-slot.level-2 .time-label {
    font-size: 0.5rem;
    min-width: 55px;
}

.time-slot.level-3 .time-label {
    font-size: 0.45rem;
    min-width: 65px;
}

.time-value {
    flex: 1;
    font-size: 0.75rem;
    font-weight: 600;
    color: #667eea;
    text-align: left;
}

.time-value.empty {
    color: #ccc;
}

.time-slot.level-1 .time-value {
    font-size: 0.65rem;
}

.time-slot.level-2 .time-value {
    font-size: 0.5rem;
}

.time-slot.level-3 .time-value {
    font-size: 0.45rem;
}

.value-code {
    font-weight: 700;
    margin-right: 4px;
}

.value-desc {
    font-size: 0.65rem;
    font-weight: 400;
    color: #888;
}

.time-slot.level-1 .value-desc {
    font-size: 0.55rem;
}

.time-slot.level-2 .value-desc {
    font-size: 0.45rem;
}

.time-slot.level-3 .value-desc {
    font-size: 0.4rem;
}

.summary-section {
    position: sticky;
    top: 10px;
}

.code-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    margin-bottom: 12px;
}

.code-btn {
    padding: 8px 6px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
}

.code-btn:hover {
    border-color: #667eea;
    background: #f8f5ff;
}

.code-btn:active {
    transform: scale(0.97);
}

.code-btn-code {
    font-size: 0.8rem;
    font-weight: 700;
    color: #667eea;
}

.code-btn-desc {
    font-size: 0.6rem;
    color: #888;
    margin-top: 2px;
}

.code-btn.clear-btn {
    border-color: #fca5a5;
    background: #fef2f2;
}

.code-btn.clear-btn:hover {
    border-color: #ef4444;
    background: #fee2e2;
}

.code-btn.clear-btn .code-btn-code {
    color: #ef4444;
}

.selection-hint {
    font-size: 0.7rem;
    color: #888;
    text-align: center;
    margin-bottom: 8px;
    padding: 6px;
    background: #f8f9fa;
    border-radius: 4px;
}

.selection-hint strong {
    color: #667eea;
}

.summary-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
    max-height: 150px;
    overflow-y: auto;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 0.75rem;
}

.summary-item-code {
    font-weight: 600;
    color: #333;
}

.summary-item-time {
    font-weight: 700;
    color: #667eea;
}

.total-time {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    color: white;
    margin-bottom: 8px;
    font-size: 0.85rem;
}

.total-value {
    font-size: 1.1rem;
    font-weight: 700;
}

.btn {
    width: 100%;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.5);
}

.empty-message {
    text-align: center;
    color: #999;
    padding: 12px;
    font-size: 0.75rem;
}

.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: #333;
    color: white;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* コンテキストメニュー */
.context-menu {
    position: fixed;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    padding: 4px 0;
    z-index: 2000;
    min-width: 150px;
    display: none;
}

.context-menu.show {
    display: block;
}

.context-menu-item {
    padding: 8px 16px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.15s;
}

.context-menu-item:hover {
    background: #f3f4f6;
}

.context-menu-item.disabled {
    color: #999;
    cursor: default;
}

.context-menu-item.disabled:hover {
    background: transparent;
}

.context-menu-item.hidden {
    display: none;
}

/* レポートプレビュー */
.report-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 3000;
}

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

.report-modal {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
}

.report-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #333;
}

.report-close {
    font-size: 1.4rem;
    cursor: pointer;
    color: #999;
    line-height: 1;
}

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

.report-content {
    padding: 16px;
    margin: 0;
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 0.8rem;
    line-height: 1.6;
    color: #333;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.report-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-top: 1px solid #eee;
}

.report-footer .btn {
    width: auto;
    padding: 8px 24px;
}

.report-copy-status {
    font-size: 0.75rem;
    color: #667eea;
    font-weight: 500;
}
