.media-launcher{margin:24px 0;padding-top:22px;border-top:1px solid var(--line)}.media-launcher-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:16px 0}.media-launcher-grid button{min-height:56px}.media-privacy{font-size:13px;color:var(--muted)}.media-gallery{display:grid;gap:16px;margin:18px 0}.media-item{margin:0;padding:14px;background:var(--paper);border:1px solid var(--line);border-radius:15px;overflow:hidden}.media-item img{display:block;width:100%;max-height:420px;object-fit:contain;border-radius:9px;background:#e8e3d8}.media-item video{display:block;width:100%;max-height:420px;background:#211f1a;border-radius:9px}.media-item audio{display:block;width:100%;margin:10px 0}.media-item figcaption{display:grid;gap:6px;margin-top:12px;font-size:13px;overflow-wrap:anywhere}.media-item-header{display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap}.media-item small{color:var(--muted)}.media-download{display:inline-flex;align-items:center;min-height:48px;color:var(--gold);font-size:14px;font-weight:600;text-decoration:underline;overflow-wrap:anywhere}.media-auth-state{padding:16px;border:1px solid var(--line);border-radius:14px;margin:16px 0}.media-dialog{width:min(530px,calc(100% - 24px));max-height:calc(100dvh - 24px);padding:23px;overflow-y:auto;overscroll-behavior:contain}.media-dialog-header{display:flex;align-items:center;justify-content:space-between;gap:14px}.media-dialog-header h2{font-size:24px}.media-dialog-header button{font-size:25px;min-width:48px;flex-shrink:0;padding:6px}.media-dialog .media-round-label{font-size:14px;color:var(--gold);font-weight:650;margin:8px 0 18px}.media-dialog p{margin:12px 0}.media-dialog .media-status{font-weight:650;color:var(--ink);font-size:18px;margin:18px 0 9px}.media-dialog .subtle{font-size:13px}.media-dialog .media-error{padding:12px 14px;background:var(--danger-soft);color:var(--danger);border-radius:12px;font-size:14px}.media-kind-picker{display:grid;gap:12px;margin:20px 0}.media-main-actions{display:grid;gap:10px;margin-top:21px}.media-main-actions .primary,.media-main-actions .danger{min-height:56px}.media-preview{margin:19px 0;background:#eeebe2;border-radius:15px;overflow:hidden}.media-preview img{display:block;width:100%;max-height:45dvh;object-fit:contain}.media-preview video{display:block;width:100%;max-height:45dvh;object-fit:contain;background:#211f1a}.media-preview audio{display:block;width:100%;padding:9px}.media-preview [hidden]{display:none!important}.recording-state{display:flex;gap:10px;align-items:center;padding:14px;background:var(--danger-soft);color:var(--danger);border-radius:12px}.recording-state strong{margin-left:auto;font-size:25px;font-variant-numeric:tabular-nums}.recording-dot{width:13px;height:13px;border-radius:50%;background:var(--danger);flex-shrink:0}.media-progress-wrap{display:flex;align-items:center;gap:12px;margin:18px 0;font-variant-numeric:tabular-nums}.media-progress-wrap progress{appearance:auto;width:100%;height:12px;accent-color:var(--success)}.media-discard-confirm{padding:15px;border:1px solid #dfb3a8;background:var(--danger-soft);border-radius:13px;margin:18px 0}.media-discard-confirm p{color:var(--ink)}.media-tray{position:fixed;bottom:max(14px,env(safe-area-inset-bottom));left:50%;transform:translateX(-50%);width:min(520px,calc(100% - 28px));z-index:30;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 14px;background:var(--paper);border:1px solid #bea36d;box-shadow:0 6px 30px #30261024;border-radius:16px}.media-tray>span{font-size:13px;font-weight:600;overflow-wrap:anywhere}.media-tray button{font-size:13px;flex-shrink:0;max-width:47%;min-height:48px;padding:9px 11px}.has-media-tray .shell{padding-bottom:110px}.history-list{display:grid;gap:15px;margin-top:23px}.history-session-button{text-align:left;width:100%;padding:20px;display:grid;gap:8px}.history-session-button strong{font-size:18px}.history-session-button span,.history-session-button time{font-size:13px;font-weight:400;color:var(--muted)}.history-detail .timeline>li{padding-left:19px}.history-instructions{white-space:pre-wrap;font-size:15px;line-height:1.7;margin:13px 0!important;color:var(--ink)!important}.history-detail .media-item p{color:var(--ink)}
@media(max-width:370px){.media-dialog{padding:18px;max-height:calc(100dvh - 16px)}.media-dialog-header h2{font-size:22px}.media-dialog .button-row{display:grid;grid-template-columns:1fr}.media-launcher-grid{gap:8px}.media-launcher-grid button{padding:10px 7px;font-size:14px}.media-tray{gap:8px;padding:10px}.media-tray>span{font-size:12px}.media-tray button{font-size:12px;max-width:50%}.media-item{padding:11px}.history-detail .timeline>li{padding-left:15px}}
/* The camera owns the screen; preview and upload reuse the same original-round draft. */
.media-help{margin:12px 0;font-size:13px}.media-help summary{min-height:48px;display:flex;align-items:center;cursor:pointer}.media-inline-status{position:fixed;z-index:60;bottom:calc(92px + env(safe-area-inset-bottom));left:50%;transform:translateX(-50%);width:max-content;max-width:calc(100% - 32px);padding:13px 19px;border-radius:18px;background:#252c27;color:#fff;font-size:14px;box-shadow:0 8px 30px #0002}.voice-recording-hud{position:fixed;z-index:45;left:50%;transform:translateX(-50%);bottom:calc(88px + env(safe-area-inset-bottom));display:flex;align-items:center;gap:12px;width:min(560px,calc(100% - 24px));min-height:70px;padding:16px;border-radius:18px;background:#f4fbf0;border:2px solid #547a52;color:#28452e;box-shadow:0 7px 25px #0002;pointer-events:none}.voice-recording-hud strong{font-size:24px;font-variant-numeric:tabular-nums}.voice-recording-hud span:last-child{font-size:14px}.voice-recording-hud.cancel{background:#fff0e9;border-color:#b84835;color:#a83b28}.camera-fullscreen{width:100vw!important;max-width:none;max-height:none!important;height:100dvh;margin:0;padding:calc(12px + env(safe-area-inset-top)) 18px calc(18px + env(safe-area-inset-bottom));border:0;border-radius:0;background:#141916;color:#fff;overflow-y:auto}.camera-fullscreen .media-dialog-header{position:relative;z-index:2}.camera-fullscreen .media-dialog-header h2{font-size:20px;color:#fff}.camera-fullscreen .media-dialog-header button{color:#fff;background:#ffffff18}.camera-fullscreen .media-round-label{color:#dfca9a;font-size:12px;margin:0}.camera-fullscreen .media-status{font-size:14px;color:#fff;margin:10px 0}.camera-fullscreen .subtle,.camera-fullscreen .media-help{color:#d1d7d1}.camera-fullscreen .media-preview{width:100%;height:calc(100dvh - 360px);min-height:160px;max-height:66dvh;background:#060806;margin:12px 0;border-radius:12px}.camera-fullscreen .media-preview img,.camera-fullscreen .media-preview video{height:100%;max-height:none;width:100%;object-fit:contain}.camera-fullscreen.camera-live .media-preview{height:calc(100dvh - 260px);max-height:none}.camera-fullscreen.camera-live .media-preview video{object-fit:cover}.camera-fullscreen.camera-live .media-help,.camera-fullscreen.camera-live #km-file-info,.camera-fullscreen.camera-live #km-hint{display:none}.camera-controls{display:flex;align-items:center;justify-content:center;gap:32px;min-height:82px}.camera-controls button{border:1px solid #ffffff66;background:#ffffff1a;color:#fff;min-width:56px;min-height:56px}.camera-controls .camera-shutter{width:76px;height:76px;min-width:76px;border:4px solid #fff;border-radius:50%;font-size:37px;padding:0;background:#ffffff28}.camera-controls .camera-flip{position:absolute;left:calc(50% - 130px);border-radius:50%;font-size:27px}.camera-fullscreen .media-main-actions{grid-template-columns:1fr 1fr;gap:10px;margin-top:12px}.camera-fullscreen .media-main-actions #km-stop,.camera-fullscreen .media-main-actions #km-existing,.camera-fullscreen .media-main-actions #km-save-draft,.camera-fullscreen .media-main-actions #km-discard,.camera-fullscreen .media-main-actions #km-done{grid-column:1/-1}.camera-fullscreen .media-main-actions #km-upload{background:#cceac7;color:#183c25}.camera-fullscreen .media-main-actions #km-retake{background:#ffffff15;color:#fff;border-color:#ffffff55}.camera-fullscreen .media-main-actions #km-discard{color:#eee}.camera-fullscreen .media-error{color:#ffccbc;background:#682918}.camera-fullscreen .recording-state{background:#742a29;color:#fff}.camera-fullscreen .recording-dot{background:#ff6b6b}.has-composer .media-tray{bottom:calc(92px + env(safe-area-inset-bottom))}.has-composer.has-media-tray .shell{padding-bottom:195px}.media-item figcaption details{margin:0}.media-item figcaption summary{min-height:48px;display:flex;align-items:center;font-size:12px;color:var(--muted);cursor:pointer}.media-item figcaption details span{display:block;font-size:12px}.group-clip-label{font-size:12px;color:var(--muted)}
@media(min-width:900px){.camera-fullscreen .media-preview{max-width:920px;margin-left:auto;margin-right:auto}.camera-fullscreen .media-main-actions,.camera-fullscreen .media-progress-wrap{max-width:540px;margin-left:auto;margin-right:auto}}
/* Compact media sending: the content is primary; technical details stay in the info menu. */
.media-dialog[open]{display:flex;flex-direction:column;gap:0}
.media-dialog .media-dialog-header{flex-shrink:0;gap:8px;position:relative;min-height:52px;z-index:5}
.media-dialog .media-dialog-header h2{flex:1;min-width:0;margin:0;font-size:17px;font-weight:600}
.media-dialog .media-dialog-header button{width:48px;height:48px;min-width:48px;border:0;border-radius:50%;background:transparent;padding:0}
.media-dialog .media-dialog-header .media-help{position:static;margin:0;color:inherit}
.media-dialog .media-help summary{display:grid;place-items:center;width:48px;height:48px;min-height:48px;padding:0;border-radius:50%;list-style:none;font-size:0;cursor:pointer}
.media-dialog .media-help summary::-webkit-details-marker{display:none}
.media-dialog .media-help summary::before,.media-dialog .media-help summary::after{display:none}
.media-dialog .media-help-content{position:absolute;top:56px;right:0;width:min(340px,calc(100vw - 32px));max-height:65dvh;overflow:auto;padding:16px;border:1px solid #ffffff25;border-radius:16px;background:#fffdf8;color:#26352c;box-shadow:0 10px 45px #0004;font-size:13px;line-height:1.5;z-index:10}
.media-dialog .media-help-content p{margin:0 0 12px;font-size:13px;line-height:1.5}
.media-dialog .media-help-content .media-round-label{font-size:13px;color:inherit;margin-bottom:12px}
.media-dialog .media-help-content .media-download{color:#19765a;margin:0;min-height:48px}
.media-dialog .media-main-actions{display:flex;align-items:center;justify-content:flex-start;gap:12px;flex-wrap:wrap;margin:14px 0 0;flex-shrink:0}
.media-dialog .media-main-actions .media-action-icon{display:grid;place-items:center;width:48px;height:48px;min-height:48px;min-width:48px;flex:0 0 48px;padding:0;border-radius:50%;border:0;background:#e5e9e2;color:#52635b}
.media-dialog .media-main-actions .media-send-icon{margin-left:auto;width:58px;height:58px;min-height:58px;flex-basis:58px;background:#168b66;color:#fff;box-shadow:none}
.media-dialog .media-main-actions .media-stop-icon{margin:0 auto;width:64px;height:64px;min-height:64px;flex-basis:64px;border:3px solid #d54e4e;background:transparent}
.media-stop-icon span{display:block;width:24px;height:24px;border-radius:5px;background:#df5353}
.media-dialog .media-main-actions #km-existing,.media-dialog .media-main-actions #km-done{flex-basis:100%;margin:0}
.media-dialog .media-status{font-size:14px;font-weight:500;line-height:1.45}
.media-dialog .media-discard-confirm{flex-shrink:0}
.media-dialog.camera-fullscreen{padding:calc(8px + env(safe-area-inset-top)) 12px calc(14px + env(safe-area-inset-bottom));background:#101411;overflow:hidden}
.media-dialog.camera-fullscreen .media-preview{flex:1 1 0;min-height:100px;max-height:none;height:auto;width:100%;margin:10px 0 0;background:#101411;border-radius:0;overflow:hidden}
.media-dialog.camera-fullscreen .media-preview img,.media-dialog.camera-fullscreen .media-preview video{height:100%;width:100%;max-height:none;object-fit:contain;background:#101411}
.media-dialog.camera-fullscreen.camera-live .media-preview video{object-fit:cover}
.media-dialog.camera-fullscreen .media-help-content{background:#27322c;color:#fff;border-color:#ffffff20}
.media-dialog.camera-fullscreen .media-help-content .subtle,.media-dialog.camera-fullscreen .media-help-content .media-round-label{color:#dce5de}
.media-dialog.camera-fullscreen .media-help-content .media-download{color:#8ae6c6}
.media-dialog.camera-fullscreen.camera-live .media-help{display:block}
.media-dialog.camera-fullscreen.camera-live .media-help-content #km-file-info{display:block}
.media-dialog.camera-fullscreen .media-main-actions{width:100%;max-width:600px;align-self:center;padding:4px 8px 0;margin:12px 0 0}
.media-dialog.camera-fullscreen .media-main-actions .media-action-icon{background:#ffffff19;color:#fff;border:0}
.media-dialog.camera-fullscreen .media-main-actions #km-upload{background:#20a779;color:#fff}
.media-dialog.camera-fullscreen .media-main-actions #km-stop{border:3px solid #fff;background:transparent}
.media-dialog.camera-fullscreen .media-main-actions #km-retake{background:#ffffff19;border:0}
.media-dialog.camera-fullscreen.camera-live .media-main-actions:has(#km-stop[hidden]){display:none}
.media-dialog.camera-fullscreen .camera-controls{flex-shrink:0;margin-top:12px}
.media-dialog.camera-fullscreen .recording-state{position:absolute;top:calc(20px + env(safe-area-inset-top));left:50%;transform:translateX(-50%);z-index:6;gap:7px;padding:7px 13px;border-radius:18px;background:#a32d36;color:white;pointer-events:none}
.media-dialog.camera-fullscreen .recording-state strong{font-size:15px;margin:0}
.media-dialog.camera-fullscreen .recording-state .recording-dot{width:8px;height:8px;background:white}
.media-dialog.camera-fullscreen #km-context,.media-dialog.camera-fullscreen #km-hint,.media-dialog.camera-fullscreen #km-error{flex-shrink:0;max-height:20dvh;overflow:auto;font-size:12px;line-height:1.5;margin:8px 0}
.media-dialog.camera-fullscreen .media-progress-wrap{flex-shrink:0;width:100%;max-width:600px;align-self:center;margin:12px 0 0;font-size:13px}
.media-audio-dialog .recording-state{justify-content:center;gap:10px;margin:14px 0 4px;padding:15px;background:transparent}
.media-audio-dialog .recording-state strong{margin:0;font-size:28px}
.media-audio-dialog .media-preview{margin:16px 0 0;background:#e5f2e4;border-radius:30px}
.media-audio-dialog .media-preview audio{padding:4px}
.voice-recording-hud{min-height:52px;gap:9px;padding:10px 14px;width:min(560px,calc(100% - 24px));border:0;border-radius:26px;background:#fff;box-shadow:0 3px 14px #0002;color:#53635b;bottom:calc(82px + env(safe-area-inset-bottom))}
.voice-recording-hud .recording-dot{width:9px;height:9px;background:#d34d55}
.voice-recording-hud strong{font-size:17px;color:#273b31}
.voice-recording-hud span:last-child{font-size:12px;flex:1;text-align:right;line-height:1.35}
.voice-recording-hud.cancel{background:#fff0ee;color:#a83b28;box-shadow:0 3px 14px #a83b2825}
@media(max-width:370px){.media-dialog.camera-fullscreen{padding-left:8px;padding-right:8px}.media-dialog .media-main-actions{gap:8px}.voice-recording-hud span:last-child{font-size:11px}.media-dialog .media-help-content{width:calc(100vw - 32px)}}
/* Keep dismissal and send controls reachable in short landscape/keyboard viewports. */
.media-dialog.camera-fullscreen{overflow-y:auto;overscroll-behavior:contain}
.media-dialog.camera-fullscreen .media-dialog-header{position:sticky;top:0;background:#101411}
.media-dialog.camera-fullscreen .media-main-actions{position:sticky;bottom:0;z-index:4;background:#101411;padding-bottom:4px}
.media-dialog .media-help-content{overflow-wrap:anywhere}
.media-dialog .media-status,.media-dialog .media-error,.media-dialog .warning{overflow-wrap:anywhere}
@media(max-height:480px){
  .media-dialog.camera-fullscreen{padding-top:calc(4px + env(safe-area-inset-top));padding-bottom:calc(6px + env(safe-area-inset-bottom))}
  .media-dialog.camera-fullscreen .media-preview{min-height:60px}
  .media-dialog.camera-fullscreen .media-main-actions{margin-top:6px}
  .media-dialog.camera-fullscreen .camera-controls{min-height:70px;margin-top:6px}
  .media-dialog.camera-fullscreen #km-context,.media-dialog.camera-fullscreen #km-hint,.media-dialog.camera-fullscreen #km-error{max-height:15dvh}
  .media-dialog.camera-fullscreen .media-help-content{max-height:calc(100dvh - 80px)}
}
/* Safe-area and large-screen alignment apply equally to capture and saved previews. */
.media-dialog.camera-fullscreen{padding-left:max(12px,env(safe-area-inset-left));padding-right:max(12px,env(safe-area-inset-right));overflow-x:hidden}
.media-dialog.camera-fullscreen .media-preview{align-self:center;max-width:920px;margin-left:auto;margin-right:auto}
.media-dialog .media-dialog-header .media-help{flex:0 0 48px}
.media-dialog .media-progress-wrap progress{min-width:0;flex:1}
.media-dialog .media-progress-wrap>span{flex-shrink:0}
.media-dialog.camera-fullscreen:has(#km-recording:not([hidden])) #km-title{opacity:0}
.media-dialog .media-help-content{max-width:100%;max-height:min(65dvh,calc(100dvh - 88px))}
.media-inline-status,.voice-recording-hud,.media-tray{max-width:calc(100% - max(12px,env(safe-area-inset-left),env(safe-area-inset-right)) - max(12px,env(safe-area-inset-left),env(safe-area-inset-right)))}
.voice-recording-hud strong{flex-shrink:0}
.voice-recording-hud span:last-child{min-width:0;overflow-wrap:anywhere}
.media-tray>span{min-width:0}
@media(max-width:370px){.media-dialog.camera-fullscreen{padding-left:max(8px,env(safe-area-inset-left));padding-right:max(8px,env(safe-area-inset-right))}}
@media(min-width:768px){.media-dialog.camera-fullscreen .media-dialog-header{width:100%;max-width:960px;align-self:center}}
