* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    color: #202124;
    background: #fff;
}
a { color: #1a73e8; text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 20px;
    border-bottom: 1px solid #e0e0e0;
    flex-wrap: wrap;
}
.brand { font-size: 1.2rem; font-weight: 600; color: #202124; }
.user-info { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; font-size: 0.9rem; }

.layout { display: flex; }
.sidebar {
    width: 200px;
    flex-shrink: 0;
    padding: 16px;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: calc(100vh - 53px);
}
.sidebar a { padding: 8px 12px; border-radius: 16px; color: #202124; }
.sidebar a.active { background: #e8f0fe; color: #1a73e8; font-weight: 600; }
.quota { margin-top: auto; }
.quota-bar { background: #e0e0e0; border-radius: 4px; height: 6px; overflow: hidden; }
.quota-fill { background: #1a73e8; height: 100%; }

.content { flex: 1; padding: 20px; min-width: 0; }

.breadcrumb { margin-bottom: 12px; color: #5f6368; overflow-wrap: anywhere; }

.toolbar { display: flex; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.inline-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

.search-form { display: flex; gap: 6px; margin-bottom: 14px; }
.search-form input[type="search"] { flex: 1 1 auto; min-width: 0; padding: 8px; border: 1px solid #dadce0; border-radius: 4px; }
.search-form button { padding: 8px 14px; border: 1px solid #dadce0; border-radius: 4px; background: #fff; cursor: pointer; white-space: nowrap; }

.upload-progress { margin: -4px 0 16px; }
.upload-progress-bar { background: #e0e0e0; border-radius: 4px; height: 8px; overflow: hidden; }
.upload-progress-fill { background: #1a73e8; height: 100%; width: 0; transition: width 0.15s linear; }
.upload-progress span { display: block; margin-top: 4px; font-size: 0.85rem; color: #5f6368; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.file-table { width: 100%; min-width: 560px; border-collapse: collapse; }
.file-table th { text-align: left; padding: 8px; border-bottom: 2px solid #e0e0e0; color: #5f6368; font-size: 0.85rem; white-space: nowrap; }
.file-table td { padding: 8px; border-bottom: 1px solid #f1f1f1; vertical-align: middle; }
.file-table .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.thumb { width: 28px; height: 28px; object-fit: cover; border-radius: 4px; vertical-align: middle; margin-right: 2px; }
.empty { text-align: center; color: #9aa0a6; padding: 30px 0; }

.inline-action { display: inline; }
.link-btn { background: none; border: none; color: #1a73e8; cursor: pointer; padding: 0; font-size: inherit; }
.link-btn:hover { text-decoration: underline; }

.error { color: #d93025; }
.hint { color: #5f6368; font-size: 0.9rem; }

.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: #f7f7f7; padding: 16px; }
.auth-box { background: #fff; padding: 32px; border-radius: 8px; box-shadow: 0 1px 6px rgba(0,0,0,0.15); width: 100%; max-width: 320px; }
.auth-box label { display: block; margin-bottom: 12px; font-size: 0.9rem; }
.auth-box input { display: block; width: 100%; padding: 8px; margin-top: 4px; border: 1px solid #dadce0; border-radius: 4px; }
.auth-box button { width: 100%; padding: 10px; background: #1a73e8; color: #fff; border: none; border-radius: 4px; cursor: pointer; font-size: 1rem; }

.google-btn {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    width: 100%; padding: 10px; border: 1px solid #dadce0; border-radius: 4px;
    background: #fff; color: #3c4043; font-weight: 500; box-sizing: border-box;
}
.google-btn:hover { background: #f7f7f7; text-decoration: none; }

.share-form { display: flex; gap: 16px; align-items: end; margin-bottom: 24px; flex-wrap: wrap; }
.share-form label { display: flex; flex-direction: column; font-size: 0.85rem; gap: 4px; flex: 1 1 180px; }
.share-form input, .share-form select { padding: 6px; border: 1px solid #dadce0; border-radius: 4px; width: 100%; }
.share-form button { padding: 8px 16px; background: #1a73e8; color: #fff; border: none; border-radius: 4px; cursor: pointer; }

.public-link-row { display: flex; gap: 8px; margin: 8px 0; }
.public-link-row input { flex: 1 1 auto; min-width: 0; padding: 8px; border: 1px solid #dadce0; border-radius: 4px; font-family: monospace; font-size: 0.85rem; }
.public-link-row button { padding: 8px 14px; background: #1a73e8; color: #fff; border: none; border-radius: 4px; cursor: pointer; white-space: nowrap; }

.public-page { display: flex; justify-content: center; padding: 24px 16px; }
.public-card { width: 100%; max-width: 640px; text-align: center; }
.public-card h1 { font-size: 1.15rem; word-break: break-word; }
.public-preview-img { max-width: 100%; max-height: 70vh; border-radius: 8px; margin: 16px 0; }
.public-preview-media { width: 100%; max-height: 70vh; border-radius: 8px; margin: 16px 0; background: #000; }
.public-preview-audio { width: 100%; margin: 16px 0; }
.public-preview-frame { width: 100%; height: 75vh; border: 1px solid #e0e0e0; border-radius: 8px; margin: 16px 0; }
.public-card .google-btn { max-width: 220px; margin: 0 auto; }

/* --- Mobile --- */
@media (max-width: 768px) {
    .layout { flex-direction: column; }
    .sidebar {
        width: 100%;
        min-height: auto;
        flex-direction: row;
        align-items: center;
        overflow-x: auto;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        padding: 10px 12px;
        gap: 6px;
    }
    .sidebar a { padding: 6px 10px; white-space: nowrap; }
    .quota { margin-top: 0; margin-left: auto; min-width: 110px; }
    .quota small { white-space: nowrap; }

    .content { padding: 14px; }

    .toolbar { flex-direction: column; align-items: stretch; }
    .inline-form { width: 100%; }
    .inline-form input[type="text"] { flex: 1 1 auto; min-width: 0; }
    .inline-form input[type="file"] { flex: 1 1 auto; min-width: 0; max-width: 100%; }

    .share-form { flex-direction: column; align-items: stretch; }
    .share-form label { flex: 1 1 auto; }

    .public-link-row { flex-direction: column; align-items: stretch; }
    .public-preview-frame { height: 60vh; }

    h1 { font-size: 1.3rem; }
}

@media (max-width: 420px) {
    .topbar { padding: 10px 12px; }
    .brand { font-size: 1.05rem; }
    .auth-box { padding: 24px 20px; }
}
