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

body {
    font-family: 'Segoe UI', 'Meiryo', sans-serif;
    background: #0a0e17;
    color: #e0e0e0;
    min-height: 100vh;
}

/* Auth Pages */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-card {
    background: #141a26;
    border: 1px solid #2a3a4a;
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
}

.auth-card h1 {
    text-align: center;
    margin-bottom: 8px;
    color: #fff;
    font-size: 24px;
}

.auth-card .subtitle {
    text-align: center;
    color: #888;
    margin-bottom: 30px;
    font-size: 14px;
}

.tab-group {
    display: flex;
    margin-bottom: 24px;
    border-bottom: 2px solid #2a3a4a;
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    color: #888;
    padding: 10px;
    font-size: 14px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

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

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: #aaa;
}

.form-group input {
    width: 100%;
    padding: 10px 14px;
    background: #0d1320;
    border: 1px solid #2a3a4a;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: #4fc3f7;
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #1e88e5, #4fc3f7);
    border: none;
    border-radius: 6px;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    margin-top: 8px;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.error-msg {
    background: rgba(255, 50, 50, 0.15);
    border: 1px solid rgba(255, 50, 50, 0.3);
    color: #ff6b6b;
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 13px;
    display: none;
}

.error-msg.show {
    display: block;
}

.success-msg {
    background: rgba(0, 200, 100, 0.15);
    border: 1px solid rgba(0, 200, 100, 0.3);
    color: #69f0ae;
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 13px;
    display: none;
}

.success-msg.show {
    display: block;
}

/* Chart Page */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: #141a26;
    border-bottom: 1px solid #2a3a4a;
}

.header h1 {
    font-size: 18px;
    color: #4fc3f7;
}

.home-link {
    color: #666;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    letter-spacing: 1px;
    transition: color 0.2s;
}

.home-link:hover {
    color: #4fc3f7;
    text-decoration: none;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info {
    color: #aaa;
    font-size: 13px;
}

.btn-logout {
    background: none;
    border: 1px solid #555;
    color: #aaa;
    padding: 6px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.btn-logout:hover {
    border-color: #ff6b6b;
    color: #ff6b6b;
}

/* Upload Section */
.upload-section {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 30px 20px;
}

.upload-wrapper {
    width: 100%;
    max-width: 640px;
}

.app-description {
    background: #141a26;
    border: 1px solid #2a3a4a;
    border-radius: 10px;
    padding: 24px;
    margin-bottom: 20px;
}

.app-description h2 {
    font-size: 18px;
    color: #fff;
    margin-bottom: 10px;
}

.app-description > p {
    font-size: 13px;
    color: #aaa;
    line-height: 1.7;
    margin-bottom: 16px;
}

.usage-steps {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.usage-steps p {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #ccc;
}

.step-num {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 22px;
    height: 22px;
    background: #1e88e5;
    color: #fff;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

/* Drop Zone */
.drop-zone {
    width: 100%;
    min-height: 160px;
    border: 2px dashed #3a4a5a;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.3s;
    padding: 24px;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: #4fc3f7;
    background: rgba(79, 195, 247, 0.05);
}

.drop-zone .icon {
    font-size: 40px;
    color: #3a4a5a;
}

.drop-zone p {
    color: #888;
    font-size: 14px;
}

.drop-zone .hint {
    font-size: 12px;
    color: #555;
}

.drop-zone input[type="file"] {
    display: none;
}

/* Disclaimer */
.disclaimer {
    margin-top: 16px;
    padding: 14px 16px;
    background: rgba(255, 165, 0, 0.06);
    border: 1px solid rgba(255, 165, 0, 0.15);
    border-radius: 8px;
}

.disclaimer p {
    font-size: 11px;
    color: #888;
    line-height: 1.6;
}

.disclaimer strong {
    color: #bbb;
}

/* Upload Progress */
.upload-progress {
    display: none;
    width: 100%;
    max-width: 600px;
    margin: 20px auto 0;
    text-align: center;
}

.progress-bar {
    height: 4px;
    background: #2a3a4a;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #1e88e5, #4fc3f7);
    width: 0;
    transition: width 0.3s;
}

.upload-status {
    color: #888;
    font-size: 13px;
}

/* Chart Area */
.chart-section {
    display: none;
    flex-direction: row;
    justify-content: center;
    align-items: flex-start;
    gap: 12px;
    padding: 10px;
}

.chart-main {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.chart-container {
    position: relative;
    background: #000;
    border: 1px solid #2a3a4a;
    border-radius: 4px;
    max-width: 100%;
    overflow: hidden;
}

/* Canvas: 内部解像度1240x950を保ちつつ表示サイズを縮小 */
.chart-container canvas {
    display: block;
    width: min(740px, calc(100vw - 40px));
    height: auto;
}

/* 広告枠 */
.ad-slot {
    width: 160px;
    min-height: 600px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed #2a3a4a;
    border-radius: 6px;
    flex-shrink: 0;
    position: sticky;
    top: 60px;
}

/* 画面が狭い場合は広告枠を非表示 */
@media (max-width: 1100px) {
    .ad-slot { display: none; }
    .chart-section { flex-direction: column; align-items: center; }
}

/* Controls */
.controls {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: #141a26;
    border: 1px solid #2a3a4a;
    border-radius: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
    max-width: min(740px, calc(100vw - 40px));
    width: 100%;
}

.controls button {
    background: #1e88e5;
    border: none;
    color: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
    white-space: nowrap;
}

.controls button:hover {
    background: #1565c0;
}

.controls button.recording {
    background: #f44336;
}

.controls button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-back {
    background: #37474f !important;
    margin-left: auto;
}

.btn-back:hover {
    background: #455a64 !important;
}

.speed-control {
    display: flex;
    align-items: center;
    gap: 6px;
}

.speed-control label {
    font-size: 11px;
    color: #aaa;
}

.speed-control input[type="range"] {
    width: 80px;
    accent-color: #4fc3f7;
}

.speed-value {
    font-size: 11px;
    color: #4fc3f7;
    min-width: 30px;
}

.time-display {
    font-size: 12px;
    color: #aaa;
    font-family: monospace;
}

.format-select {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #aaa;
}

.format-select select {
    background: #0d1320;
    border: 1px solid #2a3a4a;
    color: #e0e0e0;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 11px;
}

.threshold-control {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #aaa;
}

.threshold-control input[type="number"] {
    width: 70px;
    background: #0d1320;
    border: 1px solid #2a3a4a;
    color: #e0e0e0;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 11px;
    text-align: right;
}

.threshold-unit {
    font-size: 11px;
    color: #888;
}

.filename-display {
    font-size: 11px;
    color: #69f0ae;
}
