/*
 * Desktop browser adaptation for InkMind.
 * The original content and interaction code remain in index.html; this file
 * only changes layout, sizing, navigation placement, and responsive behavior.
 */

:root {
  --desktop-shell: 1720px;
  --desktop-nav: 220px;
  --desktop-gap: 24px;
  --desktop-surface: rgba(245, 241, 232, 0.96);
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 8% 10%, rgba(184, 66, 58, 0.08), transparent 28%),
    radial-gradient(circle at 92% 88%, rgba(92, 124, 80, 0.09), transparent 30%),
    #e8e4dc;
}

button,
input {
  font: inherit;
}

button:focus-visible,
input:focus-visible,
.quick-action:focus-visible,
.tutorial-card:focus-visible,
.setting-item:focus-visible {
  outline: 3px solid rgba(184, 66, 58, 0.35);
  outline-offset: 3px;
}

/* Desktop application header */
.topbar {
  min-height: 68px;
  padding: 14px max(24px, calc((100vw - var(--desktop-shell)) / 2 + 24px));
  flex-wrap: nowrap;
  background: rgba(245, 241, 232, 0.9);
  box-shadow: 0 1px 0 rgba(26, 26, 46, 0.04);
}

.topbar-title {
  font-size: 1.08rem;
}

.topbar-title .seal-mark {
  width: 34px;
  height: 34px;
  line-height: 34px;
  border-radius: 9px;
}

.lang-toggle button {
  min-width: 46px;
  min-height: 34px;
}

/* Remove the device mockup and turn it into a browser application shell. */
.workspace {
  width: min(100%, var(--desktop-shell));
  margin: 0 auto;
  padding: 28px 24px 48px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  justify-content: stretch;
  gap: 28px;
}

.phone-frame {
  width: 100%;
  max-width: none;
  height: auto;
  min-width: 0;
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.phone-screen {
  width: 100%;
  height: auto;
  min-height: calc(100vh - 144px);
  display: grid;
  grid-template-columns: var(--desktop-nav) minmax(0, 1fr);
  grid-template-rows: auto;
  align-items: start;
  gap: var(--desktop-gap);
  overflow: visible;
  border-radius: 0;
  background: transparent;
}

.phone-notch,
.status-bar {
  display: none;
}

.screen-container {
  grid-column: 2;
  grid-row: 1;
  width: 100%;
  height: auto;
  min-width: 0;
  position: relative;
  overflow: visible;
}

.screen {
  position: relative;
  inset: auto;
  width: 100%;
  height: auto;
  min-height: calc(100vh - 124px);
  padding: clamp(24px, 3vw, 42px);
  overflow: visible;
  border: 1px solid rgba(26, 26, 46, 0.06);
  border-radius: 24px;
  background: var(--desktop-surface);
  box-shadow: 0 18px 50px rgba(26, 26, 46, 0.1);
}

.screen > div[style="height:20px;"] {
  display: none;
}

/* Desktop side navigation */
.tab-bar,
.tab-bar.active {
  grid-column: 1;
  grid-row: 1;
  position: sticky;
  top: 96px;
  left: auto;
  bottom: auto;
  width: 100%;
  height: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  gap: 6px;
  border: 1px solid rgba(26, 26, 46, 0.07);
  border-radius: 18px;
  background: rgba(245, 241, 232, 0.9);
  box-shadow: 0 12px 34px rgba(26, 26, 46, 0.08);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.tab-item {
  width: 100%;
  min-height: 52px;
  padding: 10px 14px;
  flex-direction: row;
  justify-content: flex-start;
  gap: 12px;
  border-radius: 11px;
  text-align: left;
}

.tab-item:hover {
  background: rgba(26, 26, 46, 0.05);
}

.tab-item.active {
  background: var(--ink);
}

.tab-item .tab-icon {
  width: 28px;
  height: 28px;
  font-size: 1.08rem;
  filter: grayscale(1);
}

.tab-item .tab-label {
  font-size: 0.86rem;
}

.tab-item.active .tab-icon,
.tab-item.active .tab-label {
  color: var(--paper);
  filter: none;
}

/* Shared desktop spacing and type */
.page-header {
  padding: 0 0 24px;
}

.page-header h1 {
  margin-bottom: 6px;
  font-size: clamp(1.8rem, 2.2vw, 2.5rem);
}

.page-header .subtitle {
  font-size: 0.98rem;
}

.section-title {
  margin: 4px 0 12px;
  font-size: 1rem;
}

.btn-primary {
  width: 100%;
  min-height: 50px;
  margin: 0;
  padding: 14px 18px;
  font-size: 0.92rem;
}

.pill {
  padding: 5px 11px;
  font-size: 0.74rem;
}

/* Home: dashboard layout */
#inkzen-home.active {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(310px, 0.82fr);
  grid-template-rows: auto auto auto auto auto auto;
  align-content: start;
  gap: 16px 22px;
}

#inkzen-home > .page-header {
  grid-column: 1 / -1;
  grid-row: 1;
}

#inkzen-home > .ink-hero {
  grid-column: 1;
  grid-row: 2;
}

#inkzen-home > .daily-lesson {
  grid-column: 2;
  grid-row: 2 / span 5;
}

#inkzen-home > .btn-primary {
  grid-column: 1;
  grid-row: 3;
}

#inkzen-home > .section-title:nth-child(5) {
  grid-column: 1;
  grid-row: 4;
}

#inkzen-home > .quick-actions {
  grid-column: 1;
  grid-row: 5;
}

#inkzen-home > .section-title:nth-child(7) {
  grid-column: 1;
  grid-row: 6;
}

#inkzen-home > .streak-calendar {
  grid-column: 1;
  grid-row: 7;
}

.ink-hero,
.daily-lesson,
.quick-actions,
.streak-calendar {
  margin: 0;
}

.ink-hero {
  min-height: 214px;
  padding: 30px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.ink-hero .hero-greeting {
  font-size: 0.9rem;
}

.ink-hero .hero-title {
  font-size: clamp(1.45rem, 2vw, 2rem);
}

.ink-hero .hero-sub {
  font-size: 0.9rem;
}

.ink-hero .hero-stats {
  gap: clamp(22px, 4vw, 52px);
  margin-top: 20px;
  padding-top: 18px;
}

.ink-hero .hero-stat .num {
  font-size: 1.7rem;
}

.ink-hero .hero-stat .lbl {
  font-size: 0.76rem;
}

.daily-lesson {
  padding: 24px;
}

.daily-lesson .lesson-visual {
  height: 218px;
}

.quick-actions {
  gap: 12px;
}

.quick-action {
  min-height: 92px;
  padding: 16px 10px;
}

.quick-action .qa-label {
  font-size: 0.8rem;
}

.streak-calendar {
  padding: 18px;
}

.streak-calendar .cal-day {
  min-height: 42px;
  aspect-ratio: auto;
  font-size: 0.74rem;
}

/* Paint: large workspace with an adjacent control column. */
#inkzen-canvas.active {
  display: grid;
  grid-template-columns: minmax(480px, 1.55fr) minmax(300px, 0.82fr);
  grid-template-rows: auto auto auto auto auto auto auto;
  align-items: start;
  gap: 14px 22px;
}

#inkzen-canvas > .canvas-toolbar {
  grid-column: 1 / -1;
  grid-row: 1;
}

#inkzen-canvas > .canvas-area {
  grid-column: 1;
  grid-row: 2 / span 6;
}

#inkzen-canvas > .quote-card {
  grid-column: 2;
  grid-row: 2;
}

#inkzen-canvas > .guide-panel {
  grid-column: 2;
  grid-row: 3;
}

#inkzen-canvas > .brush-tools {
  grid-column: 2;
  grid-row: 4;
}

#inkzen-canvas > .ink-colors {
  grid-column: 2;
  grid-row: 5;
}

#inkzen-canvas > .reference-image {
  grid-column: 2;
  grid-row: 6;
}

#inkzen-canvas > .btn-primary {
  grid-column: 2;
  grid-row: 7;
}

.canvas-toolbar {
  padding: 0 0 18px;
}

.canvas-toolbar .tool-title {
  font-size: 1.05rem;
}

.canvas-toolbar .tool-actions button {
  width: 40px;
  height: 40px;
}

.canvas-area {
  width: 100%;
  height: min(68vh, 720px);
  min-height: 520px;
  margin: 0;
}

.canvas-area .brush-size-control {
  top: 14px;
  right: 14px;
  padding: 7px 12px;
}

.canvas-area .brush-size-control input[type="range"] {
  width: 126px;
}

.canvas-area .clear-btn,
.canvas-area .ref-toggle-btn {
  top: 14px;
  min-height: 30px;
  padding: 6px 11px;
}

.canvas-area .clear-btn {
  left: 14px;
}

.canvas-area .ref-toggle-btn {
  left: 78px;
}

.quote-card,
.guide-panel,
.brush-tools,
.ink-colors,
.reference-image {
  margin: 0;
}

.quote-card,
.guide-panel,
.reference-image {
  padding: 16px;
}

.brush-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  overflow: visible;
}

.brush-tool {
  justify-content: center;
}

.ink-colors {
  min-height: 44px;
  gap: 14px;
}

.ink-color {
  width: 32px;
  height: 32px;
}

/* Tutorials: responsive desktop card gallery. */
#inkzen-tutorials.active {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-content: start;
  gap: 18px;
}

#inkzen-tutorials > .page-header,
#inkzen-tutorials > .tutorial-search,
#inkzen-tutorials > .tutorial-categories {
  grid-column: 1 / -1;
}

.tutorial-search,
.tutorial-categories,
.tutorial-card {
  margin: 0;
}

.tutorial-search {
  min-height: 48px;
  padding: 11px 16px;
}

.tutorial-search input {
  font-size: 0.95rem;
}

.tutorial-categories {
  flex-wrap: wrap;
  overflow: visible;
  gap: 8px;
  padding-bottom: 4px;
}

.tut-cat {
  padding: 8px 16px;
  font-size: 0.8rem;
}

.tutorial-card {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  box-shadow: 0 7px 20px rgba(26, 26, 46, 0.04);
}

.tutorial-card.completed {
  border-color: rgba(92, 124, 80, 0.4);
}

.tutorial-complete-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(92, 124, 80, 0.92);
  color: var(--paper);
  font-size: 0.72rem;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(26, 26, 46, 0.12);
}

.tutorial-card:hover {
  transform: translateY(-4px);
  border-color: rgba(184, 66, 58, 0.18);
  box-shadow: 0 12px 28px rgba(26, 26, 46, 0.09);
}

.tutorial-card .tut-thumb {
  height: 156px;
  font-size: 3rem;
}

.tutorial-card .tut-info {
  flex: 1;
  padding: 16px;
}

.tutorial-card .tut-info h4 {
  min-height: 2.6em;
  font-size: 0.94rem;
  line-height: 1.35;
}

.tutorial-card .tut-info .tut-meta {
  flex-wrap: wrap;
  row-gap: 7px;
  font-size: 0.73rem;
}

/* Progress: two-column report. */
#inkzen-progress.active {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: auto auto auto auto;
  align-content: start;
  gap: 16px 22px;
}

#inkzen-progress > .page-header {
  grid-column: 1 / -1;
  grid-row: 1;
}

#inkzen-progress > .brain-age-hero {
  grid-column: 1;
  grid-row: 2;
}

#inkzen-progress > .progress-stats {
  grid-column: 2;
  grid-row: 2;
}

#inkzen-progress > .section-title:nth-child(4) {
  grid-column: 1;
  grid-row: 3;
}

#inkzen-progress > .skill-chart {
  grid-column: 1;
  grid-row: 4;
}

#inkzen-progress > .section-title:nth-child(6) {
  grid-column: 2;
  grid-row: 3;
}

#inkzen-progress > .achievement-list {
  grid-column: 2;
  grid-row: 4;
}

.brain-age-hero,
.progress-stats,
.skill-chart,
.achievement-list {
  margin: 0;
}

.brain-age-hero {
  min-height: 218px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.progress-stats {
  min-height: 218px;
  gap: 12px;
}

.progress-stat {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.skill-chart {
  height: 100%;
  padding: 22px;
}

.achievement-list {
  height: 100%;
  gap: 12px;
}

.achievement {
  min-height: 104px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: opacity 0.2s, transform 0.2s;
}

.achievement:not(.locked) {
  border-color: rgba(196, 163, 90, 0.45);
  background: rgba(255, 255, 255, 0.78);
}

/* Settings: profile summary followed by a two-column settings grid. */
#inkzen-profile.active {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 18px 22px;
}

#inkzen-profile > .page-header,
#inkzen-profile > .profile-header {
  grid-column: 1 / -1;
}

.profile-header,
.settings-group {
  margin: 0;
}

.profile-header {
  padding: 24px;
}

.profile-avatar {
  width: 64px;
  height: 64px;
  font-size: 1.45rem;
}

.profile-info h3 {
  font-size: 1.12rem;
}

.setting-item {
  min-height: 60px;
  padding: 14px 16px;
}

.setting-item .si-label {
  font-size: 0.9rem;
}

.setting-item input {
  min-height: 34px;
}

@media (max-width: 1420px) {
  .workspace {
    max-width: 1280px;
  }
}

/* Compact desktop/tablet: horizontal web navigation and simpler grids. */
@media (max-width: 1040px) {
  .workspace {
    padding: 20px 18px 40px;
  }

  .phone-screen {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .tab-bar,
  .tab-bar.active {
    order: 1;
    position: sticky;
    top: 76px;
    width: 100%;
    padding: 8px;
    flex-direction: row;
    justify-content: stretch;
    overflow-x: auto;
    z-index: 40;
  }

  .screen-container {
    order: 2;
    width: 100%;
  }

  .tab-item {
    min-width: 116px;
    justify-content: center;
  }

  #inkzen-canvas.active {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
  }

  #inkzen-canvas > .canvas-toolbar,
  #inkzen-canvas > .canvas-area,
  #inkzen-canvas > .quote-card,
  #inkzen-canvas > .guide-panel,
  #inkzen-canvas > .brush-tools,
  #inkzen-canvas > .ink-colors,
  #inkzen-canvas > .reference-image,
  #inkzen-canvas > .btn-primary {
    grid-column: 1;
    grid-row: auto;
  }

  .canvas-area {
    height: min(70vw, 680px);
    min-height: 500px;
  }

  #inkzen-tutorials.active {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Narrow browser windows remain a web page, without restoring phone chrome. */
@media (max-width: 720px) {
  .topbar {
    min-height: 60px;
    padding: 10px 14px;
  }

  .topbar-title {
    font-size: 0.9rem;
  }

  .topbar-title .seal-mark {
    width: 30px;
    height: 30px;
    line-height: 30px;
  }

  .workspace {
    width: 100%;
    padding: 12px 10px 30px;
    gap: 14px;
  }

  .tab-bar,
  .tab-bar.active {
    top: 64px;
    border-radius: 14px;
  }

  .tab-item {
    min-width: 74px;
    min-height: 48px;
    padding: 8px 10px;
    flex-direction: column;
    gap: 3px;
  }

  .tab-item .tab-icon {
    width: 22px;
    height: 22px;
  }

  .tab-item .tab-label {
    font-size: 0.68rem;
  }

  .screen {
    min-height: calc(100vh - 150px);
    padding: 20px 16px 26px;
    border-radius: 18px;
  }

  #inkzen-home.active,
  #inkzen-progress.active,
  #inkzen-profile.active,
  #inkzen-tutorials.active {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
  }

  #inkzen-home > .page-header,
  #inkzen-home > .ink-hero,
  #inkzen-home > .daily-lesson,
  #inkzen-home > .btn-primary,
  #inkzen-home > .section-title:nth-child(5),
  #inkzen-home > .quick-actions,
  #inkzen-home > .section-title:nth-child(7),
  #inkzen-home > .streak-calendar,
  #inkzen-progress > .page-header,
  #inkzen-progress > .brain-age-hero,
  #inkzen-progress > .progress-stats,
  #inkzen-progress > .section-title:nth-child(4),
  #inkzen-progress > .skill-chart,
  #inkzen-progress > .section-title:nth-child(6),
  #inkzen-progress > .achievement-list,
  #inkzen-profile > .page-header,
  #inkzen-profile > .profile-header,
  #inkzen-tutorials > .page-header,
  #inkzen-tutorials > .tutorial-search,
  #inkzen-tutorials > .tutorial-categories {
    grid-column: 1;
    grid-row: auto;
  }

  .ink-hero {
    min-height: 0;
    padding: 22px;
  }

  .daily-lesson .lesson-visual {
    height: 160px;
  }

  .canvas-area {
    height: min(96vw, 560px);
    min-height: 380px;
  }

  .canvas-area .brush-size-control input[type="range"] {
    width: 78px;
  }

  .brush-tools {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tutorial-card .tut-thumb {
    height: 136px;
  }

  .tutorial-card .tut-info h4 {
    min-height: 0;
  }

}

@media (max-width: 460px) {
  .topbar-title > span:last-child {
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .lang-toggle button {
    min-width: 38px;
    padding: 5px 8px;
  }

  .screen {
    padding-inline: 14px;
  }

  .quick-actions,
  .achievement-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .canvas-area .brush-size-control {
    top: 50px;
    left: 14px;
    right: auto;
  }
}
