/* Quivo — v0.4.0 */
:root {
  --red: #e11d2e;
  --red-dark: #c11425;
  --ink: #14151a;
  --muted: #6f7280;
  --line: #e7e7ea;
  --bg: #ffffff;
  --soft: #f6f6f7;
  --ease: cubic-bezier(0.22, 0.8, 0.2, 1);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

button { font-family: inherit; }

/* ---------------------------------------------------------------- login */
.auth {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  animation: fade 0.2s var(--ease);
}

.auth-box {
  width: 100%;
  max-width: 340px;
}

.brand {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--red);
}

.sub {
  margin: 4px 0 24px;
  color: var(--muted);
  font-size: 13.5px;
}

.tabs {
  display: flex;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}

.tab {
  padding: 0 0 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.16s var(--ease), border-color 0.16s var(--ease);
}

.tab.is-active {
  color: var(--ink);
  border-bottom-color: var(--red);
  font-weight: 600;
}

.label {
  display: block;
  margin: 0 0 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
}

input[type="text"],
input[type="password"],
input[type="search"] {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-size: 16px;
  outline: none;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}

input::placeholder { color: #a2a4ad; }

input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(225, 29, 46, 0.1);
}

#authForm input { margin-bottom: 14px; }

.btn {
  width: 100%;
  height: 44px;
  margin-top: 4px;
  border: 0;
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.16s var(--ease), transform 0.1s var(--ease), opacity 0.16s;
}

.btn:active { background: var(--red-dark); transform: scale(0.99); }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }

.error {
  margin: 0 0 12px;
  color: var(--red);
  font-size: 13px;
  animation: fade 0.16s var(--ease);
}

/* ----------------------------------------------------------------- home */
#homeView {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 12px;
  padding-top: env(safe-area-inset-top);
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.16s var(--ease);
}

.icon-btn:active { background: var(--soft); }

.icon-btn svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
}

.bar-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--red);
}

.search {
  position: relative;
  padding: 12px 16px 0;
}

.search svg {
  position: absolute;
  left: 28px;
  top: 50%;
  transform: translateY(-30%);
  width: 16px;
  height: 16px;
  fill: none;
  stroke: #a2a4ad;
  stroke-width: 1.9;
  stroke-linecap: round;
}

.search input {
  height: 40px;
  padding-left: 36px;
  background: var(--soft);
  border-color: transparent;
  font-size: 14.5px;
}

.search input:focus { background: #fff; }

.list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 20px 16px 10px;
}

.list-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.list-head span {
  font-size: 12px;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0 16px 24px;
}

.card {
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  text-align: left;
  overflow: hidden;
  cursor: pointer;
  color: inherit;
  transition: background 0.16s var(--ease), transform 0.1s var(--ease);
}

.card:active { background: var(--soft); transform: scale(0.99); }

.thumb {
  position: relative;
  aspect-ratio: 3 / 2;
  display: grid;
  place-items: center;
  background: #fdf3f4;
}

.thumb span {
  font-size: 28px;
  font-weight: 700;
  color: var(--red);
  letter-spacing: -0.03em;
}

.card-body { padding: 8px 10px 10px; }

.card-title {
  margin: 0 0 2px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-meta {
  margin: 0;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  animation: fade 0.2s var(--ease);
}

.empty p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
}

.foot {
  padding: 0 16px calc(20px + env(safe-area-inset-bottom));
  color: #b3b5bd;
  font-size: 11.5px;
}

/* ----------------------------------------------------------------- menu */
.menu {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: #fff;
  overflow-y: auto;
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
  padding-top: calc(16px + env(safe-area-inset-top));
  animation: slide-right 0.22s var(--ease);
}

.menu-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.avatar {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  flex: none;
}

.menu-user {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.menu-user strong {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu-user span {
  font-size: 12px;
  color: var(--muted);
}

.menu-list {
  display: flex;
  flex-direction: column;
  margin-top: 8px;
}

.menu-list-last { margin-top: 20px; }

.row {
  display: flex;
  align-items: center;
  width: 100%;
  height: 50px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.16s var(--ease);
}

.row:active { background: var(--soft); }

.row-red { color: var(--red); border-bottom: 0; }

/* ---------------------------------------------------------------- sheet */
.sheet-wrap {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.32);
  animation: fade 0.2s var(--ease);
}

.sheet {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 16px 16px 0 0;
  padding: 6px 16px calc(18px + env(safe-area-inset-bottom));
  animation: rise 0.24s var(--ease);
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0 12px;
}

.sheet-head h3 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.sheet-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: fade 0.18s var(--ease);
}

.warn {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes rise {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes slide-right {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* --------------------------------------------------------------- desktop */
@media (min-width: 720px) {
  .grid { grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .bar, .search, .list-head, .grid, .foot, .empty { max-width: 880px; margin-left: auto; margin-right: auto; }
  .bar { padding: 0 20px; }
  .search { padding: 16px 20px 0; }
  .list-head { padding: 24px 20px 12px; }
  .grid { padding: 0 20px 32px; }
  .foot { padding: 0 20px 28px; }
  .menu { max-width: 420px; margin: 0 auto; border-right: 1px solid var(--line); border-left: 1px solid var(--line); }
  .sheet { border-radius: 16px; margin-bottom: 24px; }
  .sheet-wrap { align-items: center; }
}

/* --------------------------------------------------------------- player */
.player-body { overflow: hidden; }

.player {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

.player-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 52px;
  padding: 0 8px;
  padding-top: env(safe-area-inset-top);
  background: #fff;
  border-bottom: 1px solid var(--line);
  flex: none;
}

.player-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.player-stage {
  position: relative;
  flex: 1;
  background: #fff;
}

.player-stage iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.player-stage .empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
