:root {
  color-scheme: light;
  --bg: #eef7ff;
  --surface: #f8fbff;
  --surface-strong: #ffffff;
  --ink: #102033;
  --muted: #5c6f86;
  --line: #c9d8ea;
  --teal: #1d4ed8;
  --teal-dark: #123f91;
  --coral: #e05b5b;
  --blue: #0284c7;
  --gold: #c7921d;
  --sky: #d9efff;
  --aqua: #79d8ff;
  --shadow: 0 14px 34px rgba(31, 72, 122, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Hiragino Sans",
    "Yu Gothic",
    sans-serif;
  letter-spacing: 0;
  background:
    linear-gradient(180deg, rgba(29, 78, 216, 0.14), rgba(125, 211, 252, 0.12) 260px, transparent 420px),
    var(--bg);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 720px);
  min-height: 100svh;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 16px calc(88px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: -14px -16px 12px;
  padding: max(14px, env(safe-area-inset-top)) 16px 12px;
  background: rgba(238, 247, 255, 0.9);
  border-bottom: 1px solid rgba(157, 183, 214, 0.62);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(29, 78, 216, 0.2);
}

.header-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 8px;
}

.sync-status {
  min-width: 64px;
  padding: 6px 8px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.sync-status[data-status="online"] {
  color: var(--teal-dark);
  border-color: rgba(29, 78, 216, 0.35);
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 1.2rem;
  line-height: 1.1;
}

h2 {
  margin-bottom: 12px;
  font-size: 1.06rem;
  line-height: 1.2;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.hero-panel {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 112px;
  gap: 16px;
  min-height: 174px;
  overflow: hidden;
  padding: 22px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(18, 63, 145, 0.96), rgba(2, 132, 199, 0.84)),
    url("./assets/court.svg") center / cover;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero-panel h2 {
  margin-bottom: 10px;
  font-size: clamp(1.45rem, 6vw, 2.3rem);
}

.hero-panel p {
  margin-bottom: 0;
  line-height: 1.65;
}

.hero-panel .eyebrow {
  color: rgba(255, 255, 255, 0.72);
}

.court-visual {
  position: relative;
  align-self: stretch;
  min-height: 130px;
  border: 2px solid rgba(255, 255, 255, 0.54);
  border-radius: 7px;
}

.court-visual::before,
.court-visual::after,
.court-visual span {
  position: absolute;
  content: "";
  background: rgba(255, 255, 255, 0.5);
}

.court-visual::before {
  top: 50%;
  left: 0;
  width: 100%;
  height: 2px;
}

.court-visual::after {
  top: 0;
  left: 50%;
  width: 2px;
  height: 100%;
}

.court-visual span:first-child {
  top: 22%;
  left: 0;
  width: 100%;
  height: 1px;
}

.court-visual span:last-child {
  bottom: 22%;
  left: 0;
  width: 100%;
  height: 1px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 14px 0;
}

.metric {
  min-height: 88px;
  padding: 14px 10px;
  text-align: center;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric span {
  display: block;
  color: var(--teal-dark);
  font-size: 1.55rem;
  font-weight: 800;
}

.metric p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.section-block {
  margin-top: 18px;
}

.detail-grid {
  display: grid;
  gap: 16px;
}

.subhead {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.section-block.first {
  margin-top: 4px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.entry-list,
.note-list,
.tag-bars,
.source-grid,
.event-list,
.focus-list {
  display: grid;
  gap: 10px;
}

.entry-card,
.note-card,
.event-card,
.event-row {
  padding: 14px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.entry-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.entry-card h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.entry-card p,
.note-card p {
  margin-bottom: 8px;
  color: var(--muted);
  line-height: 1.55;
  white-space: pre-wrap;
}

.entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
}

.chip-row,
.tag-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip,
.tag-option {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 10px;
  color: var(--teal-dark);
  font-size: 0.8rem;
  font-weight: 700;
  background: #dff2ff;
  border: 1px solid #a9d8f4;
  border-radius: 999px;
}

.tag-option {
  color: var(--muted);
  background: var(--surface);
}

.tag-option.selected {
  color: #fff;
  background: var(--teal);
  border-color: var(--teal);
}

.tag-bar {
  padding: 12px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.tag-bar-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-weight: 700;
}

.bar-track {
  width: 100%;
  height: 9px;
  overflow: hidden;
  background: #d8e6f5;
  border-radius: 999px;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--blue));
  border-radius: inherit;
}

.form-stack {
  display: grid;
  gap: 14px;
  padding-top: 4px;
}

label,
.field-label {
  display: grid;
  gap: 7px;
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  min-height: 46px;
  padding: 11px 12px;
  color: var(--ink);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.15);
}

input[type="range"] {
  padding: 0;
  accent-color: var(--teal);
  background: transparent;
  border: none;
}

.range-value {
  color: var(--teal-dark);
  font-size: 0.82rem;
}

.form-row {
  display: grid;
  gap: 12px;
}

.form-row.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.match-only-fields {
  display: grid;
  gap: 14px;
}

.match-only-fields.hidden {
  display: none;
}

.advice-box {
  display: grid;
  gap: 14px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.toolbar {
  position: sticky;
  top: 72px;
  z-index: 8;
  display: grid;
  grid-template-columns: 1fr 118px;
  gap: 10px;
  margin: -4px -2px 14px;
  padding: 8px 2px;
  background: rgba(238, 247, 255, 0.92);
  backdrop-filter: blur(12px);
}

.search-field span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.primary-button,
.secondary-button,
.text-button,
.icon-button,
.danger-button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  font-weight: 800;
}

.primary-button {
  color: #fff;
  background: var(--teal);
  box-shadow: 0 10px 22px rgba(29, 78, 216, 0.24);
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  color: var(--teal-dark);
  background: var(--surface-strong);
  border: 1px solid var(--line);
}

.text-button {
  min-height: 34px;
  padding: 0 4px;
  color: var(--teal-dark);
  background: transparent;
}

.icon-button {
  width: 44px;
  flex: 0 0 44px;
  color: var(--teal-dark);
  background: var(--surface-strong);
  border: 1px solid var(--line);
}

.danger-button {
  min-height: 34px;
  padding: 0 8px;
  color: #fff;
  background: var(--coral);
}

.settings-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.muted,
.plain-text {
  color: var(--muted);
  line-height: 1.6;
}

.empty {
  padding: 18px;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.48);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

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

.source-card {
  padding: 14px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.source-card strong {
  display: block;
  color: var(--blue);
  font-size: 1.4rem;
}

.countdown-card {
  display: grid;
  gap: 10px;
}

.event-notice-block {
  padding-top: 4px;
}

.event-notice-list {
  gap: 8px;
}

.event-notice {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.event-notice-date {
  display: grid;
  place-items: center;
  min-height: 64px;
  padding: 8px 6px;
  text-align: center;
  background: #dff2ff;
  border-radius: 8px;
}

.event-notice-date strong {
  color: var(--teal-dark);
  font-size: 0.92rem;
}

.event-notice-date span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.event-notice h3 {
  margin: 5px 0 3px;
  font-size: 0.98rem;
}

.event-notice p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.tournament-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
  border-color: rgba(184, 129, 24, 0.42);
  background: linear-gradient(135deg, #f8fbff, #fff8e8);
}

.tournament-card h3 {
  margin: 0 0 6px;
  font-size: 1.08rem;
}

.tournament-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.tournament-card strong {
  display: grid;
  place-items: center;
  min-width: 86px;
  min-height: 86px;
  padding: 8px;
  color: #fff;
  text-align: center;
  background: var(--gold);
  border-radius: 999px;
}

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

.compact-tournament {
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 12px;
}

.compact-tournament h3 {
  font-size: 0.95rem;
}

.compact-tournament p {
  font-size: 0.82rem;
}

.compact-tournament strong {
  min-width: 0;
  min-height: 36px;
  padding: 6px 10px;
  border-radius: 999px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}

.calendar-weekday,
.calendar-day {
  display: grid;
  place-items: center;
  min-height: 42px;
  font-size: 0.78rem;
  font-weight: 800;
  border-radius: 8px;
}

.calendar-weekday {
  min-height: 26px;
  color: var(--muted);
}

.calendar-day {
  gap: 3px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
}

.calendar-day.today {
  color: #fff;
  background: var(--teal);
  border-color: var(--teal);
}

.muted-day {
  background: transparent;
  border-color: transparent;
}

.calendar-dots {
  display: flex;
  min-height: 8px;
  gap: 3px;
}

.calendar-dots i {
  width: 7px;
  height: 7px;
  border-radius: 999px;
}

.practice-dot {
  background: var(--blue);
}

.tournament-dot {
  background: var(--coral);
}

.personal-dot {
  background: var(--gold);
}

.event-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.event-row strong {
  display: block;
  margin: 4px 0;
}

.event-row p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.compact-event-row {
  padding: 11px 12px;
}

.event-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.event-scope {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  color: var(--teal-dark);
  font-size: 0.72rem;
  font-weight: 800;
  background: #dff2ff;
  border-radius: 999px;
}

.event-scope.personal {
  color: #6b4a0d;
  background: #fff1cd;
}

.event-kind {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  border-radius: 999px;
}

.event-kind.practice {
  background: var(--blue);
}

.event-kind.tournament {
  background: var(--coral);
}

.focus-card {
  padding: 0;
  overflow: hidden;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.focus-card summary {
  display: flex;
  min-height: 66px;
  padding: 13px 14px;
  list-style: none;
  cursor: pointer;
}

.focus-card summary::-webkit-details-marker {
  display: none;
}

.focus-card summary::after {
  margin-left: auto;
  color: var(--muted);
  content: "見る";
  font-size: 0.76rem;
  font-weight: 800;
}

.focus-card[open] summary::after {
  content: "閉じる";
}

.focus-card-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.focus-card-main strong {
  display: -webkit-box;
  overflow: hidden;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.focus-card-main small {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.focus-card p,
.focus-card .chip-row {
  margin: 0 14px 12px;
  color: var(--muted);
  line-height: 1.55;
  white-space: pre-wrap;
}

.entry-details-card {
  padding: 0;
  overflow: hidden;
}

.entry-details-card summary {
  display: flex;
  min-height: 58px;
  padding: 13px 14px;
  list-style: none;
  cursor: pointer;
}

.entry-details-card summary::-webkit-details-marker {
  display: none;
}

.entry-details-card summary span {
  display: grid;
  gap: 3px;
}

.entry-details-card summary small {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.entry-details-card summary::after {
  margin-left: auto;
  color: var(--muted);
  content: "開く";
  font-size: 0.76rem;
  font-weight: 800;
}

.entry-details-card[open] summary::after {
  content: "閉じる";
}

.entry-details-card p,
.entry-details-card .chip-row,
.entry-details-card .danger-button {
  margin: 0 14px 12px;
}

.schedule-form-block {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.tabbar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  width: min(100%, 720px);
  margin: 0 auto;
  padding: 8px 8px max(8px, env(safe-area-inset-bottom));
  background: rgba(248, 251, 255, 0.95);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.tab {
  display: grid;
  place-items: center;
  gap: 3px;
  min-height: 58px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  background: transparent;
  border: 0;
  border-radius: 8px;
}

.tab span {
  font-size: 1.08rem;
  line-height: 1;
}

.tab.active {
  color: #fff;
  background: linear-gradient(135deg, var(--teal), var(--blue));
  box-shadow: 0 8px 18px rgba(29, 78, 216, 0.22);
}

.toast {
  position: fixed;
  right: 16px;
  bottom: calc(84px + env(safe-area-inset-bottom));
  left: 16px;
  z-index: 50;
  display: none;
  width: min(420px, calc(100% - 32px));
  margin: 0 auto;
  padding: 13px 14px;
  color: #fff;
  text-align: center;
  background: rgba(23, 32, 29, 0.92);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.toast.show {
  display: block;
}


.brand-mascot {
  width: 54px;
  height: 42px;
  flex: 0 0 auto;
  image-rendering: pixelated;
  filter: drop-shadow(0 8px 12px rgba(29, 78, 216, 0.22));
}

.entry-card,
.note-card,
.event-card,
.event-row,
.source-card,
.tag-bar,
.focus-card,
.metric,
.advice-box {
  box-shadow: 0 8px 20px rgba(31, 72, 122, 0.055);
}


.event-notice {
  border-color: rgba(29, 78, 216, 0.18);
  box-shadow: 0 8px 18px rgba(31, 72, 122, 0.06);
}

.event-notice-date {
  border: 1px solid rgba(2, 132, 199, 0.18);
}

.focus-card {
  border-color: rgba(29, 78, 216, 0.16);
}

.focus-card[open] {
  border-color: rgba(29, 78, 216, 0.34);
}

.focus-card summary::after {
  color: var(--teal-dark);
}

@media (max-width: 430px) {
  .app-shell {
    padding-right: 12px;
    padding-left: 12px;
  }

  .topbar {
    margin-right: -12px;
    margin-left: -12px;
    padding-right: 12px;
    padding-left: 12px;
  }

  .brand-mascot {
    width: 44px;
    height: 34px;
  }

  .hero-panel {
    grid-template-columns: 1fr;
    min-height: 220px;
  }

  .court-visual {
    min-height: 74px;
  }

  .form-row.two,
  .settings-actions,
  .toolbar,
  .compact-countdown,
  .event-notice {
    grid-template-columns: 1fr;
  }

  .event-notice-date {
    min-height: 48px;
  }

  .metric {
    min-height: 82px;
  }
}


@media (max-width: 380px) {
  .topbar {
    gap: 10px;
  }

  .brand {
    gap: 7px;
  }

  .brand-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
  }

  .brand-mascot {
    width: 36px;
    height: 28px;
  }

  h1 {
    font-size: 1.02rem;
  }

  .eyebrow {
    font-size: 0.64rem;
  }

  .sync-status {
    min-width: 54px;
    padding-right: 6px;
    padding-left: 6px;
    font-size: 0.66rem;
  }

  .icon-button {
    width: 40px;
    flex-basis: 40px;
  }
}
