:root {
  font-family:-apple-system,BlinkMacSystemFont,"SF Pro Display","Segoe UI",sans-serif;
  background:#050505;
  color:#fff;
}

* {
  box-sizing:border-box;
  -webkit-tap-highlight-color:transparent;
}

html,
body {
  margin:0;
  min-height:100%;
  background:#050505;
}

body {
  min-height:100dvh;
  overflow-x:hidden;
}

button,
textarea {
  font:inherit;
}

button {
  border:0;
  color:inherit;
}

.app {
  min-height:100dvh;
  display:flex;
  justify-content:center;
  padding:18px;
  padding-bottom:calc(18px + env(safe-area-inset-bottom));
}

.panel {
  width:min(520px,100%);
  margin:auto 0;
}

.header {
  display:flex;
  align-items:center;
  gap:13px;
  margin-bottom:22px;
}

.brand-mark {
  width:46px;
  height:46px;
  border-radius:14px;
  display:grid;
  place-items:center;
  background:#111;
  border:1px solid #292929;
  font-size:23px;
}

.header h1 {
  margin:0;
  font-size:18px;
  letter-spacing:-.3px;
}

.header p {
  margin:3px 0 0;
  color:#707070;
  font-size:13px;
}

.dropzone {
  width:100%;
  min-height:220px;
  border:1px dashed #303030;
  border-radius:22px;
  background:#090909;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:9px;
  color:#fff;
}

.drop-icon {
  width:50px;
  height:50px;
  border-radius:16px;
  background:#151515;
  display:grid;
  place-items:center;
  font-size:25px;
}

.dropzone b {
  font-size:15px;
}

.dropzone small {
  color:#666;
  font-size:13px;
}

input[type=file] {
  display:none;
}

.actions {
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:8px;
  margin-top:9px;
}

.actions button {
  min-height:49px;
  border-radius:13px;
  border:1px solid #252525;
  background:#0b0b0b;
  font-size:13px;
}

.file-list {
  display:grid;
  gap:7px;
  margin-top:14px;
}

.file {
  padding:12px;
  border:1px solid #222;
  border-radius:12px;
  background:#0b0b0b;
  color:#aaa;
  font-size:13px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.send-button {
  width:100%;
  min-height:52px;
  margin-top:12px;
  border-radius:14px;
  background:#fff;
  color:#000;
  font-weight:650;
}

.send-button:disabled {
  opacity:.25;
}

.status {
  min-height:22px;
  margin-top:12px;
  text-align:center;
  color:#777;
  font-size:13px;
}


/* FULLSCREEN */

.screen {
  position:fixed;
  inset:0;
  z-index:1000;
  display:none;
  background:#000;
}

.screen.active {
  display:flex;
}


/* CAMERA */

#cameraScreen {
  flex-direction:column;
  overflow:hidden;
}

#cameraVideo {
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  object-fit:cover;
  background:#000;
}

.camera-gradient {
  position:absolute;
  left:0;
  right:0;
  pointer-events:none;
  z-index:2;
}

.camera-gradient.top {
  top:0;
  height:190px;
  background:linear-gradient(#000b,transparent);
}

.camera-gradient.bottom {
  bottom:0;
  height:260px;
  background:linear-gradient(transparent,#000e);
}

.camera-header {
  position:absolute;
  z-index:5;
  top:0;
  left:0;
  right:0;
  padding:calc(14px + env(safe-area-inset-top)) 14px 14px;
  display:flex;
  align-items:flex-start;
  gap:12px;
}

.round-button {
  width:44px;
  height:44px;
  flex:0 0 44px;
  border-radius:50%;
  background:#090909c9;
  backdrop-filter:blur(14px);
  font-size:29px;
}

.location-card {
  padding:10px 13px;
  border-radius:13px;
  background:#080808d0;
  backdrop-filter:blur(14px);
}

#coordinates {
  font-size:14px;
  font-weight:700;
}

#accuracy {
  margin-top:3px;
  color:#ddd;
  font-size:12px;
}

#cameraTime {
  margin-top:2px;
  color:#999;
  font-size:11px;
}

.camera-footer {
  position:absolute;
  z-index:5;
  left:0;
  right:0;
  bottom:0;
  padding:20px 20px calc(25px + env(safe-area-inset-bottom));
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:17px;
}

.camera-message {
  padding:8px 13px;
  border-radius:10px;
  background:#050505aa;
  backdrop-filter:blur(10px);
  color:#ddd;
  font-size:12px;
}

.shutter {
  width:82px;
  height:82px;
  border-radius:50%;
  background:#fff;
  border:5px solid #999;
  display:grid;
  place-items:center;
  box-shadow:0 5px 30px #0008;
}

.shutter span {
  width:64px;
  height:64px;
  border-radius:50%;
  border:2px solid #111;
}


/* EDITOR */

#editorScreen {
  flex-direction:column;
}

.editor-header,
.publish-header {
  height:60px;
  flex:0 0 60px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 15px;
  border-bottom:1px solid #222;
  background:#050505;
  z-index:3;
}

.editor-header b,
.publish-header b {
  font-size:15px;
}

.text-button {
  min-width:48px;
  padding:8px 4px;
  background:transparent;
  color:#fff;
  font-size:14px;
}

.editor-area {
  flex:1;
  min-height:0;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:10px;
  background:#000;
  overflow:hidden;
}

#editorCanvas {
  max-width:100%;
  max-height:100%;
  width:auto;
  height:auto;
  touch-action:none;
  user-select:none;
}

.toolbar {
  flex:0 0 auto;
  display:flex;
  gap:7px;
  padding:9px 9px calc(9px + env(safe-area-inset-bottom));
  overflow-x:auto;
  background:#080808;
  border-top:1px solid #222;
}

.tool {
  min-width:62px;
  height:52px;
  border-radius:11px;
  background:#151515;
  border:1px solid #292929;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:2px;
  font-size:18px;
}

.tool span {
  font-size:9px;
  color:#999;
}

.tool.active {
  background:#fff;
  color:#000;
}

.tool.active span {
  color:#333;
}


/* PUBLISH */

#publishScreen {
  flex-direction:column;
}

.publish-content {
  flex:1;
  min-height:0;
  overflow-y:auto;
  padding:18px 16px;
}

.publish-preview {
  width:100%;
  max-height:52vh;
  display:flex;
  justify-content:center;
  align-items:center;
  overflow:hidden;
  background:#090909;
  border-radius:17px;
}

#publishImage {
  max-width:100%;
  max-height:52vh;
  display:block;
  object-fit:contain;
}

.caption-block {
  position:relative;
  margin-top:18px;
}

.caption-block label {
  display:block;
  margin-bottom:8px;
  color:#aaa;
  font-size:13px;
}

#caption {
  width:100%;
  min-height:125px;
  resize:none;
  padding:14px;
  border-radius:15px;
  border:1px solid #292929;
  outline:none;
  background:#0b0b0b;
  color:#fff;
  font-size:15px;
  line-height:1.45;
}

#caption:focus {
  border-color:#555;
}

#caption::placeholder {
  color:#555;
}

.caption-counter {
  position:absolute;
  right:12px;
  bottom:10px;
  color:#555;
  font-size:11px;
}

.publish-footer {
  flex:0 0 auto;
  padding:12px 15px calc(14px + env(safe-area-inset-bottom));
  background:#050505;
  border-top:1px solid #222;
}

.primary-button {
  width:100%;
  min-height:52px;
  border-radius:14px;
  background:#fff;
  color:#000;
  font-weight:650;
}

.primary-button:disabled {
  opacity:.4;
}


/* INTERNAL GALLERY */

.gallery-entry {
  width:100%;
  min-height:50px;
  margin-bottom:9px;
  border-radius:14px;
  background:#111;
  border:1px solid #292929;
  color:#fff;
  font-weight:600;
}

.gallery-screen,
.gallery-lock-screen,
.gallery-viewer,
.gallery-settings-screen {
  flex-direction:column;
}

.gallery-header {
  height:60px;
  flex:0 0 60px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 15px;
  border-bottom:1px solid #222;
  background:#050505;
  z-index:3;
}

.gallery-header b {
  font-size:15px;
}

.gallery-controls {
  display:flex;
  gap:7px;
  padding:12px 12px 4px;
  overflow-x:auto;
}

.gallery-filter {
  min-width:82px;
  height:38px;
  padding:0 14px;
  border-radius:12px;
  background:#111;
  border:1px solid #292929;
  color:#999;
  white-space:nowrap;
}

.gallery-filter.active {
  background:#fff;
  color:#000;
}

.gallery-grid {
  flex:1;
  min-height:0;
  overflow-y:auto;
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:3px;
  padding:10px 3px 20px;
  align-content:start;
}

.gallery-item {
  position:relative;
  aspect-ratio:1;
  overflow:hidden;
  background:#101010;
  border-radius:7px;
}

.gallery-item img {
  width:100%;
  height:100%;
  display:block;
  object-fit:cover;
}

.gallery-item-badge {
  position:absolute;
  left:6px;
  bottom:6px;
  padding:4px 6px;
  border-radius:7px;
  background:#000b;
  backdrop-filter:blur(8px);
  color:#fff;
  font-size:10px;
}

.gallery-empty {
  display:none;
  flex:1;
  align-items:center;
  justify-content:center;
  color:#666;
  font-size:13px;
  padding:30px;
  text-align:center;
}

.gallery-lock {
  width:min(360px,calc(100% - 32px));
  margin:auto;
  text-align:center;
}

.gallery-lock-icon {
  width:70px;
  height:70px;
  margin:0 auto 20px;
  border-radius:22px;
  display:grid;
  place-items:center;
  background:#111;
  border:1px solid #292929;
  font-size:30px;
}

.gallery-lock h2 {
  margin:0;
  font-size:20px;
}

.gallery-lock p {
  margin:8px 0 18px;
  color:#777;
  font-size:13px;
}

#galleryCode {
  width:100%;
  height:52px;
  padding:0 15px;
  border-radius:14px;
  border:1px solid #292929;
  outline:none;
  background:#0b0b0b;
  color:#fff;
  text-align:center;
  letter-spacing:4px;
}

#galleryCode:focus {
  border-color:#555;
}

.gallery-error {
  min-height:20px;
  margin:9px 0;
  color:#ff6b6b;
  font-size:12px;
}

.gallery-cancel {
  margin-top:9px;
  width:100%;
}

.gallery-viewer-content {
  flex:1;
  min-height:0;
  overflow-y:auto;
  padding:12px;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:14px;
}

#viewerImage {
  width:100%;
  max-height:65vh;
  object-fit:contain;
  border-radius:14px;
  background:#090909;
}

.viewer-info {
  width:100%;
  padding:14px;
  border-radius:14px;
  background:#0b0b0b;
  border:1px solid #222;
  color:#aaa;
  font-size:12px;
  line-height:1.7;
}

.viewer-info b {
  color:#fff;
}

.gallery-viewer-footer {
  flex:0 0 auto;
  padding:10px 15px calc(12px + env(safe-area-inset-bottom));
  border-top:1px solid #222;
  background:#050505;
}

.settings-list {
  padding:14px;
}

.setting-row {
  min-height:58px;
  padding:0 14px;
  margin-bottom:8px;
  border-radius:14px;
  background:#0b0b0b;
  border:1px solid #222;
  display:flex;
  align-items:center;
  justify-content:space-between;
  color:#ddd;
  font-size:14px;
}

.setting-row input {
  width:20px;
  height:20px;
  accent-color:#fff;
}

@media (max-width:380px) {
  .gallery-grid {
    grid-template-columns:repeat(2,1fr);
  }
}

