@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');

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

:root {
  --bg: #f2f2f7;
  --surface: #ffffff;
  --text: #1c1c1e;
  --text-dim: #8e8e93;
  --orange: #ff7a00;
  --orange-dark: #e06d00;
  --orange-light: #fff3e8;
  --btn-shadow: 0 2px 8px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --radius: 20px;
}

html, body {
  height: 100%;
  font-family: 'Roboto', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.screen { display: none; position: fixed; inset: 0; }
.screen.active { display: flex; flex-direction: column; }

/* ════ TOAST ════ */
.toast {
  position: fixed;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: rgba(28,28,30,.9);
  color: white;
  padding: 11px 22px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 500;
  z-index: 400;
  opacity: 0;
  pointer-events: none;
  transition: all .28s ease;
  white-space: nowrap;
  backdrop-filter: blur(8px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ════ VIEWER ════ */
.viewer {
  position: fixed;
  inset: 0;
  background: black;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s;
}
.viewer.open { opacity: 1; pointer-events: all; }
.viewer img { max-width: 100vw; max-height: 100vh; object-fit: contain; }
.viewer video { max-width: 100vw; max-height: 100vh; }

.vx {
  position: absolute;
  top: 20px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
}
.vx svg { width: 18px; height: 18px; }

/* ════ MODAL ════ */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s;
}
.modal-bg.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-width: 500px;
  transform: translateY(100%);
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
  padding-bottom: max(28px, env(safe-area-inset-bottom));
}
.modal-bg.open .modal { transform: translateY(0); }

.mhandle { width: 36px; height: 4px; background: #e0e0e0; border-radius: 2px; margin: 12px auto 20px; }
.m-title { font-size: 18px; font-weight: 700; padding: 0 22px; margin-bottom: 4px; }
.m-sub { font-size: 14px; color: var(--text-dim); padding: 0 22px; margin-bottom: 18px; }
.m-body { padding: 0 22px; }

.flbl { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 7px; display: block; }

.fin {
  width: 100%;
  background: var(--bg);
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 22px;
  font-family: 'Roboto', monospace;
  font-weight: 500;
  color: var(--text);
  letter-spacing: .14em;
  text-align: center;
  outline: none;
  transition: border-color .2s;
  margin-bottom: 12px;
  -webkit-text-security: disc;
}
.fin.vis { -webkit-text-security: none; letter-spacing: .08em; }
.fin:focus { border-color: var(--orange); }

.ferr { font-size: 13px; color: #e05555; min-height: 18px; margin-bottom: 8px; }
.fok  { font-size: 13px; color: #34c759; min-height: 18px; margin-bottom: 8px; }

.m-actions { display: flex; gap: 10px; padding: 6px 22px 0; }

.mbtn {
  flex: 1;
  padding: 15px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  font-family: 'Roboto', sans-serif;
  border: none;
  cursor: pointer;
  transition: opacity .1s;
}
.mbtn:active { opacity: .7; }
.mbtn.pri { background: var(--orange); color: white; }
.mbtn.sec { background: var(--bg); color: var(--text-dim); }
.mbtn.dng { background: #fff0f0; color: #e05555; }

/* ════ ANIMATIONS ════ */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
