﻿:root {
    --ig-bg: #fafafa;
    --ig-surface: #ffffff;
    --ig-border: #dbdbdb;
    --ig-text: #262626;
    --ig-muted: #8e8e8e;
    --ig-blue: #0095f6;
    --ig-blue-strong: #1877f2;
    --ig-danger: #ed4956;
    --ig-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ig-text);
    font-family: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
    background:
        radial-gradient(circle at 8% 6%, rgba(255, 120, 120, 0.06), transparent 26%),
        radial-gradient(circle at 92% 4%, rgba(0, 149, 246, 0.08), transparent 24%),
        var(--ig-bg);
}

a {
    color: var(--ig-text);
    text-decoration: none;
}

a:hover {
    color: #111111;
}

.page-shell {
    width: min(1160px, calc(100% - 20px));
    margin: 0 auto;
    padding: 0 10px 28px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    margin-top: 0;
    margin-bottom: 18px;
    padding: 12px 12px;
    border: 1px solid var(--ig-border);
    border-top: 0;
    border-radius: 0 0 12px 12px;
    border-bottom: 1px solid var(--ig-border);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(6px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.brand {
    font-size: 1.55rem;
    font-weight: 800;
    letter-spacing: 0.3px;
    background: linear-gradient(90deg, #f58529, #dd2a7b, #8134af, #515bd4);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.top-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.top-nav a,
.top-nav button,
.link-button {
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid var(--ig-border);
    border-radius: 8px;
    background: #ffffff;
    color: var(--ig-text);
    padding: 8px 12px;
    cursor: pointer;
}

.nav-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
}

.nav-chip .nav-ico {
    display: inline-grid;
    place-items: center;
    width: 24px;
    height: 24px;
    font-size: 1.15rem;
    font-weight: 700;
    color: #555;
}

.nav-chip:hover {
    transform: translateY(-1px);
}

.nav-chip.is-active {
    border-color: #c2e4fb;
    background: #eef7ff;
}

.nav-chip.is-active .nav-ico {
    color: var(--ig-blue);
}

.top-nav a:hover,
.top-nav button:hover,
.link-button:hover {
    background: #f6f6f6;
}

.center-card {
    max-width: 560px;
    margin: 40px auto 0;
    border: 1px solid var(--ig-border);
    border-radius: 16px;
    box-shadow: var(--ig-shadow);
    background: var(--ig-surface);
    padding: 30px;
}

.hero-card {
    text-align: center;
}

.hero-card h1 {
    margin: 0;
    font-size: 2rem;
}

.hero-card p {
    color: var(--ig-muted);
}

.hero-actions {
    margin-top: 18px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.dashboard-shell {
    padding-bottom: 38px;
}

body[data-page="editor"] {
    height: 100dvh;
    overflow: hidden;
}

body[data-page="editor"] .page-shell {
    height: 100dvh;
    padding-bottom: 10px;
    display: flex;
    flex-direction: column;
}

body[data-page="editor"] .topbar {
    flex-shrink: 0;
}

body[data-page="editor"] .student-layout {
    flex: 1;
    min-height: 0;
}

body[data-page="editor"] .student-layout .panel {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

body[data-page="editor"] #createPostForm {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

body[data-page="editor"] #editorWorkArea {
    min-height: 0;
    overflow: auto;
    padding-right: 4px;
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(260px, 1fr));
    gap: 14px;
}

.student-layout,
.feed-layout {
    display: grid;
    gap: 14px;
    min-width: 0;
}

.feed-layout {
    grid-template-columns: minmax(0, 1fr);
}

.feed-main-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}

.feed-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.feed-panel-head h2 {
    margin: 0;
}

.feed-sort-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    color: #525c67;
}

.feed-sort-select {
    border: 1px solid #2d3238;
    border-radius: 10px;
    background: #2d3238;
    color: #f4f6f8;
    padding: 7px 10px;
    font-size: 0.83rem;
    font-weight: 700;
    cursor: pointer;
}

.feed-sort-select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(45, 50, 56, 0.2);
}

.panel {
    border: 1px solid var(--ig-border);
    border-radius: 14px;
    background: var(--ig-surface);
    box-shadow: var(--ig-shadow);
    padding: 16px;
    animation: rise 0.35s ease;
}

.panel.warning {
    border-color: #f2b9be;
    background: #fff9fa;
}

.notice {
    border-color: #f0d18a;
    background: #fffbf2;
}

.status-box {
    border: 1px dashed var(--ig-border);
    border-radius: 10px;
    background: #fcfcfc;
    padding: 10px;
    min-height: 64px;
}

.stack-form {
    display: grid;
    gap: 12px;
}

.stack-form label {
    display: grid;
    gap: 6px;
    font-weight: 600;
    font-size: 0.9rem;
}

input[type="text"],
input[type="password"],
input[type="file"],
textarea {
    border: 1px solid var(--ig-border);
    border-radius: 10px;
    background: #fafafa;
    color: var(--ig-text);
    padding: 10px 12px;
    font: inherit;
    width: 100%;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="file"]:focus,
textarea:focus {
    outline: none;
    border-color: #9fd2f9;
    box-shadow: 0 0 0 3px rgba(0, 149, 246, 0.12);
}

input[type="range"] {
    width: 100%;
}

textarea {
    resize: vertical;
}

.button,
button,
.link-button {
    font: inherit;
}

.button,
button {
    border: 1px solid var(--ig-border);
    border-radius: 10px;
    padding: 9px 14px;
    background: #fff;
    color: var(--ig-text);
    font-weight: 600;
    cursor: pointer;
}

.button:hover,
button:hover {
    background: #f6f6f6;
}

.button:active,
button:active {
    transform: translateY(1px);
}

.button:disabled,
button:disabled,
input:disabled,
textarea:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.button.primary {
    border-color: var(--ig-blue);
    background: var(--ig-blue);
    color: #fff;
}

.button.primary:hover {
    background: var(--ig-blue-strong);
}

.button.primary:active {
    filter: saturate(1.1);
}

.button.danger {
    border-color: #f3c2c7;
    background: #fff6f7;
    color: var(--ig-danger);
}

.button.ghost {
    background: transparent;
}

.status-text {
    min-height: 20px;
    margin: 0;
    color: var(--ig-muted);
}

.status-text.error,
.error {
    color: var(--ig-danger);
}

.status-text.success,
.success {
    color: #1f9d52;
}

.muted {
    color: var(--ig-muted);
}

.hidden {
    display: none !important;
}

.sg-no-student [data-requires-student] {
    display: none !important;
}

.file-picker-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    border: 0;
    white-space: nowrap;
}

input[type="file"].file-picker-input {
    width: 1px;
    min-width: 0;
    padding: 0;
}

.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    border-bottom: 1px solid var(--ig-border);
    padding-bottom: 10px;
    margin-bottom: 12px;
}

.profile-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.notification-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    border-color: #c9e4fa;
    background: linear-gradient(92deg, #f5fbff 0%, #ffffff 100%);
}

.notif-content p {
    margin: 2px 0 0;
    color: var(--ig-muted);
    font-size: 0.9rem;
}

.story-row {
    padding: 10px 12px;
    min-width: 0;
}

.story-track {
    display: flex;
    gap: 12px;
    min-width: 0;
    width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
}

.story-track::-webkit-scrollbar {
    height: 8px;
}

.story-track::-webkit-scrollbar-thumb {
    background: #dfdfdf;
    border-radius: 999px;
}

.story-item {
    flex: 0 0 72px;
    min-width: 72px;
    max-width: 86px;
    display: grid;
    gap: 6px;
    justify-items: center;
    text-align: center;
    animation: rise 0.35s ease;
    text-decoration: none;
}

.story-item span {
    font-size: 0.75rem;
    color: #5f5f5f;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.story-item:hover span {
    color: #1d1d1d;
}

.story-ring {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    padding: 2px;
    background: linear-gradient(145deg, #f58529 0%, #dd2a7b 52%, #8134af 78%, #515bd4 100%);
    display: grid;
    place-items: center;
}

.story-core {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid #fff;
    background: #f2f2f2;
    color: #313131;
    font-size: 0.86rem;
    font-weight: 700;
    display: grid;
    place-items: center;
    overflow: hidden;
}

.story-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.story-thumb-video {
    pointer-events: none;
}

.story-thumb-fallback {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    font-weight: 700;
}

.story-ring-create {
    background: linear-gradient(145deg, #1ea7ff 0%, #006cf7 100%);
}

.story-core-create {
    background: linear-gradient(145deg, #25afff 0%, #0576ff 100%);
    color: #fff;
    font-size: 1.65rem;
    font-weight: 600;
    line-height: 1;
}

.story-create span {
    color: #0078ff;
    font-weight: 700;
}

.story-empty {
    font-size: 0.9rem;
    padding: 10px 6px;
}

.story-bubble.placeholder {
    width: 62px;
    height: 62px;
    border-radius: 999px;
    background: linear-gradient(90deg, #efefef, #f9f9f9, #efefef);
    background-size: 200% 100%;
    animation: shimmer 1.2s linear infinite;
    display: grid;
    place-items: center;
    color: #aaa;
}

.editor-panel {
    margin: 14px 0;
    padding: 12px;
    border: 1px solid var(--ig-border);
    border-radius: 12px;
    background: #ffffff;
}

.editor-grid {
    display: grid;
    grid-template-columns: minmax(320px, 2fr) minmax(220px, 1fr);
    gap: 12px;
}

.preview-box,
.controls-box {
    border: 1px solid var(--ig-border);
    border-radius: 10px;
    background: #fff;
    padding: 10px;
}

.preview-box {
    position: relative;
    display: grid;
    place-items: center;
}

.controls-box {
    display: grid;
    gap: 10px;
    align-content: start;
}

.emoji-tools {
    border-top: 1px dashed var(--ig-border);
    padding-top: 10px;
    display: grid;
    gap: 8px;
}

.upload-step {
    margin-bottom: 8px;
}

.media-dropzone {
    width: 100%;
    border: 2px dashed #b8d4ff;
    border-radius: 14px;
    background: linear-gradient(180deg, #f8fbff 0%, #eef5ff 100%);
    min-height: 200px;
    display: grid;
    gap: 8px;
    place-items: center;
    text-align: center;
    padding: 16px;
    cursor: pointer;
}

.media-dropzone.is-dragover {
    border-color: #0a65e8;
    background: linear-gradient(180deg, #f0f7ff 0%, #e3efff 100%);
}

.media-dropzone-icon {
    width: 52px;
    height: 52px;
    border-radius: 999px;
    background: #0a65e8;
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 1.35rem;
    font-weight: 700;
}

.media-dropzone-title {
    font-size: 1rem;
    font-weight: 700;
}

.media-dropzone-sub {
    font-size: 0.9rem;
    color: var(--ig-muted);
}

.emoji-palette-title {
    margin: 0;
    font-size: 0.86rem;
    font-weight: 700;
}

.emoji-palette {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 260px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    align-content: flex-start;
}

.emoji-glyph {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    line-height: 1;
    font-size: 1.45rem;
    cursor: pointer;
    user-select: none;
    border-radius: 6px;
}

.emoji-glyph:hover,
.emoji-glyph:focus-visible {
    background: #f1f7ff;
    outline: none;
}

.emoji-tools select {
    width: 100%;
}

.emoji-hint {
    margin: 0;
    font-size: 0.82rem;
}

.inline-check {
    display: flex !important;
    align-items: center;
    gap: 8px;
}

#imageCanvas,
#videoPreview {
    width: 100%;
    max-height: 440px;
    object-fit: contain;
    background: #f4f4f4;
    border-radius: 8px;
    display: block;
}

#imageCanvas {
    touch-action: none;
    cursor: grab;
}

#imageCanvas.is-dragging {
    cursor: grabbing;
}

.emoji-trash-zone {
    position: absolute;
    left: 0;
    top: 0;
    transform: none;
    width: 56px;
    height: 56px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    font-size: 1.45rem;
    border: 2px solid rgba(34, 34, 34, 0.18);
    background: rgba(255, 255, 255, 0.92);
    color: rgba(54, 54, 54, 0.86);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
    pointer-events: none;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.emoji-trash-zone.is-active {
    border-color: rgba(255, 255, 255, 0.78);
    background: rgba(226, 52, 72, 0.94);
    color: #fff;
    box-shadow: 0 10px 22px rgba(150, 20, 40, 0.34);
}

.emoji-trash-zone.is-hit {
    animation: trash-pop 0.28s ease;
}

@keyframes trash-pop {
    0% {
        transform: scale(1);
        filter: brightness(1);
    }
    35% {
        transform: scale(1.18);
        filter: brightness(1.25);
    }
    100% {
        transform: scale(1);
        filter: brightness(1);
    }
}

.row-actions {
    display: flex;
    gap: 8px;
}

.post-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(160px, 1fr));
    gap: 10px;
}

.post-tile {
    border: 1px solid var(--ig-border);
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.post-tile img,
.post-tile video {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
    background: #f4f4f4;
}

.tile-caption {
    padding: 8px;
    font-size: 0.9rem;
}

.feed-list {
    width: min(680px, 100%);
    margin: 0 auto;
    display: grid;
    gap: 20px;
}

.feed-post {
    border: 1px solid #ececec;
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 20px 36px -28px rgba(8, 23, 41, 0.44), 0 6px 16px rgba(8, 23, 41, 0.1);
    animation: rise 0.35s ease;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.feed-post:hover {
    border-color: #d8d8d8;
    transform: translateY(-2px);
    box-shadow: 0 24px 40px -28px rgba(8, 23, 41, 0.5), 0 10px 20px rgba(8, 23, 41, 0.12);
}

.feed-post-head {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--ig-border);
    font-size: 0.92rem;
}

.feed-head-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.post-delete-btn {
    margin-left: auto;
    border: 1px solid #f3c2c7;
    background: #fff6f7;
    color: var(--ig-danger);
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 0.82rem;
    cursor: pointer;
}

.post-delete-btn:hover {
    background: #ffe9ec;
}

.comment-delete-btn {
    margin-left: 6px;
    border: none;
    background: transparent;
    color: var(--ig-danger);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0.7;
}

.comment-delete-btn:hover {
    opacity: 1;
}

.comment-delete-btn:disabled,
.post-delete-btn:disabled {
    opacity: 0.6;
    cursor: default;
}

.feed-avatar {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    background: linear-gradient(135deg, #ff7b54 0%, #ff3c78 55%, #7f49ff 100%);
    box-shadow: 0 4px 10px rgba(255, 60, 120, 0.24);
}

.feed-author {
    display: grid;
    gap: 2px;
}

.profile-link {
    color: #0a65e8;
    text-decoration: none;
}

.profile-link:hover {
    text-decoration: underline;
}

.profile-public-head h2 {
    margin: 0 0 4px;
}

.profile-public-head p {
    margin: 0;
}

.profile-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.profile-tile {
    display: block;
    text-decoration: none;
    color: inherit;
    border: 1px solid #ececec;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
}

.profile-tile-media {
    position: relative;
    aspect-ratio: 1 / 1;
    background: #f4f4f4;
    overflow: hidden;
}

.profile-tile-media img,
.profile-tile-media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.32s ease;
}

.profile-tile-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 6px 8px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.58) 100%);
    opacity: 0.86;
    transition: opacity 0.24s ease;
}

.profile-tile:hover .profile-tile-media img,
.profile-tile:hover .profile-tile-media video {
    transform: scale(1.06);
}

.profile-tile:hover .profile-tile-overlay {
    opacity: 1;
}

.feed-time {
    color: var(--ig-muted);
    font-size: 0.82rem;
}

.feed-media img,
.feed-media video {
    width: 100%;
    max-height: 620px;
    object-fit: contain;
    background: #f4f4f4;
    display: block;
}

.feed-caption {
    margin: 0;
    padding: 10px 14px 12px;
    border-bottom: 1px solid var(--ig-border);
    line-height: 1.45;
}

.post-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--ig-border);
    flex-wrap: wrap;
}

.icon-action {
    border: 0;
    background: transparent;
    color: #252525;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.icon-action:hover {
    background: #f5f7fb;
    color: #111;
}

.icon-action:active {
    transform: translateY(1px);
}

.action-ico {
    font-size: 1rem;
    line-height: 1;
}

.like-btn.is-liked {
    color: #eb3569;
}

.like-btn.is-disabled,
.like-btn:disabled {
    opacity: 0.46;
    cursor: not-allowed;
}

.likes-count {
    margin-left: auto;
    padding: 0;
    border: 0;
    background: transparent;
    font-size: 0.88rem;
    font-family: inherit;
    color: #4f4f4f;
    font-weight: 600;
    cursor: pointer;
}

.likes-count:hover {
    color: #1468a8;
    text-decoration: underline;
}

.likes-count:focus-visible {
    outline: 2px solid #1877f2;
    outline-offset: 3px;
    border-radius: 2px;
}

.likes-dialog {
    width: min(420px, calc(100vw - 32px));
    max-height: min(72dvh, 560px);
    padding: 0;
    border: 1px solid var(--ig-border);
    border-radius: 14px;
    color: var(--ig-text);
    background: var(--ig-surface);
    box-shadow: 0 22px 65px rgba(0, 0, 0, 0.24);
}

.likes-dialog::backdrop {
    background: rgba(18, 24, 32, 0.48);
}

.likes-dialog-content {
    display: flex;
    flex-direction: column;
    max-height: inherit;
}

.likes-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--ig-border);
}

.likes-dialog-header h2 {
    margin: 0;
    font-size: 1rem;
}

.likes-dialog-close {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--ig-text);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
}

.likes-dialog-close:hover {
    background: #f2f4f7;
}

.likes-dialog-status {
    margin: 0;
    padding: 12px 16px 0;
    color: var(--ig-muted);
    font-size: 0.9rem;
}

.likes-dialog-list {
    display: grid;
    gap: 2px;
    overflow-y: auto;
    margin: 0;
    padding: 8px;
    list-style: none;
}

.likes-dialog-user {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 5px 8px;
    border-radius: 8px;
    font-weight: 600;
}

.likes-dialog-user:hover {
    background: #f5f7fb;
}

.likes-dialog-avatar {
    display: grid;
    place-items: center;
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #edf3f7;
    color: #31525f;
    font-size: 0.82rem;
}

.post-highlight {
    border-color: #72c8ff !important;
    box-shadow: 0 0 0 3px rgba(0, 149, 246, 0.22), 0 20px 38px -30px rgba(0, 149, 246, 0.55);
}

.comment-section {
    padding: 12px 14px 14px;
}

.comment-list {
    display: grid;
    gap: 7px;
    margin-bottom: 10px;
}

.comment-item {
    font-size: 0.92rem;
    padding: 7px 10px;
    border-radius: 10px;
    background: linear-gradient(180deg, #fcfcfc 0%, #f9f9f9 100%);
    border: 1px solid #ededed;
}

.comment-form input[type="text"] {
    border-radius: 999px;
    background: #fff;
}

.comment-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
}

.edge-notification-stack {
    position: fixed;
    right: 16px;
    top: 86px;
    z-index: 70;
    display: grid;
    gap: 10px;
    width: min(340px, calc(100vw - 24px));
    pointer-events: none;
}

.notif-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    background: rgba(16, 20, 26, 0.78);
    backdrop-filter: blur(6px);
    color: #fff;
    pointer-events: auto;
}

.notif-title {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.84rem;
    font-weight: 700;
}

.notif-bell {
    font-size: 0.72rem;
}

.notif-badge {
    min-width: 19px;
    height: 19px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    background: #ff3d75;
    color: #fff;
    font-size: 0.73rem;
    font-weight: 700;
}

.notif-badge.is-empty {
    background: #5d6775;
}

.notif-toggle {
    border: 0;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.77rem;
    font-weight: 700;
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    cursor: pointer;
    transition: background-color 0.16s ease;
}

.notif-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

.notif-toggle.is-active {
    background: rgba(42, 213, 255, 0.22);
}

.notif-items {
    display: grid;
    gap: 10px;
}

.edge-notification {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.58);
    background: rgba(20, 24, 30, 0.85);
    color: #fff;
    box-shadow: 0 18px 32px -26px rgba(0, 0, 0, 0.62), 0 7px 18px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(7px);
    opacity: 0;
    transform: translateX(12px);
    transition: opacity 0.22s ease, transform 0.22s ease;
    pointer-events: auto;
}

.edge-notification.is-read {
    opacity: 0.72;
}

.edge-notification-stack.unread-only .edge-notification.is-read {
    display: none;
}

.edge-notification.show {
    opacity: 1;
    transform: translateX(0);
}

.edge-notification.out {
    opacity: 0;
    transform: translateX(16px);
}

.edge-notif-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: #2ad5ff;
    box-shadow: 0 0 0 4px rgba(42, 213, 255, 0.22);
}

.edge-notif-body {
    display: grid;
    gap: 2px;
}

.edge-notif-icon {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    font-size: 0.82rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.edge-notif-body strong {
    font-size: 0.86rem;
    letter-spacing: 0.02em;
}

.edge-notif-body p {
    margin: 0;
    color: rgba(255, 255, 255, 0.84);
    font-size: 0.86rem;
}

.edge-notif-action {
    border: 0;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.16s ease;
}

.edge-notif-action:hover {
    background: rgba(255, 255, 255, 0.22);
}

.edge-notif-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.edge-notif-mark {
    border: 0;
    border-radius: 999px;
    padding: 6px 9px;
    font-size: 0.76rem;
    font-weight: 700;
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    cursor: pointer;
    transition: background-color 0.16s ease;
}

.edge-notif-mark:hover {
    background: rgba(255, 255, 255, 0.2);
}

.student-edge-stack {
    top: 76px;
}

.notif-kind-post {
    border-left: 3px solid #2ad5ff;
}

.notif-kind-post .edge-notif-icon {
    background: rgba(42, 213, 255, 0.24);
}

.notif-kind-like {
    border-left: 3px solid #ff5f8e;
}

.notif-kind-like .edge-notif-icon {
    background: rgba(255, 95, 142, 0.24);
}

.notif-kind-comment {
    border-left: 3px solid #ffc34f;
}

.notif-kind-comment .edge-notif-icon {
    background: rgba(255, 195, 79, 0.24);
}

.notif-kind-follow {
    border-left: 3px solid #7ed957;
}

.notif-kind-follow .edge-notif-icon {
    background: rgba(126, 217, 87, 0.24);
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* --- Moderation, Melden, Lehrkraft --- */
.nav-badge {
    display: inline-grid;
    place-items: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--ig-danger);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
}

.teacher-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: 999px;
    background: #e8f3ff;
    color: var(--ig-blue-strong);
    font-size: 0.72rem;
    font-weight: 600;
    vertical-align: middle;
}

.report-btn {
    margin-left: auto;
    border: 1px solid var(--ig-border);
    background: transparent;
    color: var(--ig-muted);
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 0.82rem;
    cursor: pointer;
}

.report-btn:hover {
    color: var(--ig-danger);
    border-color: #f3c2c7;
}

.comment-report-btn {
    margin-left: 6px;
    border: none;
    background: transparent;
    color: var(--ig-muted);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0.6;
}

.comment-report-btn:hover {
    color: var(--ig-danger);
    opacity: 1;
}

.report-dialog-body {
    display: grid;
    gap: 10px;
    padding: 12px 16px 16px;
}

.report-reasons {
    display: grid;
    gap: 6px;
    border: 1px solid var(--ig-border);
    border-radius: 10px;
    padding: 8px 12px 10px;
    margin: 0;
}

.report-note-label {
    display: grid;
    gap: 4px;
}

.report-note-label textarea {
    width: 100%;
    resize: vertical;
    font: inherit;
    padding: 8px;
    border: 1px solid var(--ig-border);
    border-radius: 8px;
}

.moderation-layout {
    display: grid;
    grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}

.moderation-reports {
    position: sticky;
    top: 12px;
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
}

.report-list {
    display: grid;
    gap: 12px;
}

.report-card {
    border: 1px solid #f3c2c7;
    border-radius: 12px;
    background: #fffafa;
    padding: 10px 12px;
    display: grid;
    gap: 8px;
}

.report-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.report-type {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    color: var(--ig-danger);
}

.report-media img,
.report-media video {
    width: 100%;
    max-height: 200px;
    object-fit: contain;
    background: #f4f4f4;
    border-radius: 8px;
    display: block;
}

.report-text {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.report-reasons-list {
    margin: 0;
    padding-left: 18px;
    display: grid;
    gap: 4px;
    font-size: 0.88rem;
}

.report-note {
    font-style: italic;
    color: var(--ig-text);
}

.report-flag {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: 999px;
    background: #ffe9ec;
    color: var(--ig-danger);
    font-size: 0.75rem;
    font-weight: 700;
}

.feed-post.is-reported {
    border-color: #f3c2c7;
}

.comment-item.is-reported {
    background: #fff1f3;
}

.edge-notification-report .edge-notif-dot {
    background: var(--ig-danger);
    box-shadow: 0 0 0 4px rgba(237, 73, 86, 0.22);
}

/* --- Lehrer-Dashboard / Super-Admin --- */
.license-banner {
    margin: 0 0 14px;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--ig-border);
    background: var(--ig-surface);
}

.license-banner.warning {
    border-color: #f5d48a;
    background: #fff8e6;
}

.license-banner.error {
    border-color: #f3c2c7;
    background: #fff1f3;
}

.teacher-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
    gap: 14px;
    align-items: start;
}

.teacher-sessions,
.teacher-side {
    display: grid;
    gap: 14px;
    min-width: 0;
}

.session-list {
    display: grid;
    gap: 12px;
}

.session-card {
    display: grid;
    gap: 10px;
}

.session-card.is-ended {
    opacity: 0.85;
    background: #fafafa;
}

.session-card h3 {
    margin: 0 0 2px;
}

.session-card .row-actions {
    flex-wrap: wrap;
}

.session-card .row-actions .button {
    flex: 0 0 auto;
}

.session-card-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px;
}

.session-counts {
    display: flex;
    gap: 14px;
    align-items: center;
}

.session-status {
    font-weight: 600;
}

.session-status.is-active {
    color: #1a8f3c;
}

.session-join {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    background: #f3f8ff;
    border: 1px solid #d6e8ff;
}

.session-code {
    display: block;
    font-size: 1.6rem;
    letter-spacing: 0.12em;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.session-settings summary {
    cursor: pointer;
    color: var(--ig-muted);
}

.session-settings form {
    margin-top: 10px;
}

.qr-dialog-body {
    display: grid;
    gap: 8px;
    justify-items: center;
    padding: 12px 16px 18px;
    text-align: center;
}

.qr-canvas svg {
    width: min(320px, 70vw);
    height: auto;
}

.qr-code-big {
    margin: 0;
    font-size: 2.4rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.qr-link {
    margin: 0;
    word-break: break-all;
    font-size: 0.9rem;
}

.stats-row {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
}

.table-wrap {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.admin-table th,
.admin-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--ig-border);
    text-align: left;
    vertical-align: top;
}

.admin-table th {
    color: var(--ig-muted);
    font-weight: 600;
    white-space: nowrap;
}

.error-text {
    color: var(--ig-danger);
}

.warning-text {
    color: #b7791f;
}

.webcam-open-btn {
    margin-top: 12px;
    width: 100%;
}

.webcam-dialog {
    width: min(720px, calc(100vw - 32px));
}

.webcam-stage {
    position: relative;
    background: #111;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 16 / 9;
}

.webcam-stage video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transform: scaleX(-1);
}

.webcam-live-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(237, 73, 86, 0.92);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
}

.idle-dialog h2 {
    margin: 0;
}

.identity-chip {
    max-width: 220px;
}

.identity-chip span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.students-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
    max-height: 50dvh;
    overflow-y: auto;
}

.students-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--ig-border);
    border-radius: 10px;
}

.students-list li > div {
    display: grid;
}

.small-print {
    font-size: 0.85rem;
    margin-top: 12px;
}

@media (max-width: 980px) {
    .teacher-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 980px) {
    .moderation-layout {
        grid-template-columns: 1fr;
    }

    .moderation-reports {
        position: static;
        max-height: none;
    }
}

@media (max-width: 980px) {
    .admin-grid {
        grid-template-columns: 1fr;
    }

    .editor-grid {
        grid-template-columns: 1fr;
    }

    .post-grid {
        grid-template-columns: repeat(2, minmax(140px, 1fr));
    }

    .edge-notification-stack {
        right: 12px;
        top: 72px;
    }
}

@media (max-width: 760px) {
    body[data-page="editor"] {
        height: auto;
        min-height: 100dvh;
        overflow-x: hidden;
        overflow-y: auto;
    }

    body[data-page="editor"] .page-shell {
        height: auto;
        min-height: 100dvh;
        display: block;
    }

    body[data-page="editor"] .student-layout .panel {
        height: auto;
    }

    body[data-page="editor"] #createPostForm {
        flex: none;
        min-height: auto;
        overflow: visible;
    }

    body[data-page="editor"] #editorWorkArea {
        min-height: auto;
        overflow: visible;
    }

    body[data-page="editor"] #imageCanvas {
        touch-action: pan-y;
    }

    .feed-panel-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .feed-sort-wrap {
        align-self: flex-start;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .top-nav {
        flex-wrap: wrap;
    }

    .nav-chip {
        min-height: 34px;
    }

    .top-nav a,
    .link-button {
        padding: 7px 10px;
        font-size: 0.84rem;
    }

    .hero-actions {
        flex-direction: column;
    }

    .page-shell {
        width: 100%;
        padding: 0 8px 22px;
    }

    .story-item {
        flex-basis: 64px;
        min-width: 64px;
    }

    .story-ring,
    .story-bubble.placeholder {
        width: 56px;
        height: 56px;
    }

    .profile-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .feed-post {
        border-radius: 12px;
    }

    .edge-notification-stack {
        width: calc(100vw - 14px);
        right: 7px;
        top: 68px;
    }
}
