:root {
  --bg: #f2f6ff;
  --panel: #ffffff;
  --text: #1b2554;
  --muted: #4f5fa1;
  --line: #c4cff3;
  --accent: #0c9f8e;
  --accent-soft: #b8fff3;
  --chip-event: #ffd7a6;
  --chip-travel: #c6dcff;
  --chip-lodging: #c7f4da;
  --select-strong: #bcfff0;
  --select-line: #0f8d82;
  --modal-max-width: 576px;
  --app-shell-padding: 24px;
  --app-shell-height: calc(100vh - (var(--app-shell-padding) * 2));
}

@supports (height: 100dvh) {
  :root {
    --app-shell-height: calc(100dvh - (var(--app-shell-padding) * 2));
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

html {
  font-size: 110%;
}

body {
  margin: 0;
  font-family: 'Avenir Next', 'Segoe UI', sans-serif;
  font-size: 1.0625rem;
  padding: var(--app-shell-padding);
  position: relative;
  background: #dce8fb;
  color: var(--text);
  overflow: hidden;
}

.app-shell {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: var(--app-shell-height);
  min-height: 0;
}

.app-header {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
}

.app-title {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: 0.02em;
}

.copy-ical-btn {
  border: 1px solid rgba(12, 159, 142, 0.5);
  border-radius: 999px;
  background: var(--accent-soft);
  color: #0f5d54;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 0.86rem;
  font-weight: 600;
  padding: 0 12px;
  line-height: 1;
  cursor: pointer;
}

.copy-ical-btn:hover {
  background: #9ff6e8;
}

.copy-ical-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.copy-ical-btn svg {
  flex: none;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, rgba(244, 249, 255, 0.5) 0%, rgba(233, 242, 255, 0.66) 100%);
  z-index: -1;
  pointer-events: none;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 3fr);
  gap: 22px;
  padding: 0;
  flex: 1;
  min-height: 0;
}

.calendar-panel,
.detail-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  min-height: 0;
}

.calendar-panel {
  display: flex;
  flex-direction: column;
}

.weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--line);
}

.weekdays div {
  text-align: center;
  padding: 10px 0;
  font-size: 0.95rem;
  color: var(--muted);
}

.calendar-grid {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: auto;
}

.calendar-week-group {
  display: flex;
  flex-direction: column;
}

.calendar-week-group + .calendar-week-group {
  border-top: 1px solid var(--line);
}

.week-flight-lane {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  padding: 8px 9px 6px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(201, 222, 255, 0.94) 0%, rgba(228, 239, 255, 0.9) 100%);
}

.week-flight-lane-bottom {
  padding: 6px 9px 8px;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.week-flight-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  border: 1px solid rgba(29, 78, 216, 0.45);
  border-radius: 12px;
  background: #d8e7ff;
  color: #1d2f7a;
  font-size: 0.85rem;
  padding: 4px 8px;
  text-align: left;
  overflow: hidden;
  cursor: default;
}

.week-flight-main,
.week-flight-time {
  display: block;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.week-flight-time {
  font-size: 0.76rem;
  color: #0f4fe0;
  opacity: 0.92;
}

.bullet-train-lane {
  margin-top: auto;
  position: relative;
  min-height: 86px;
  overflow: hidden;
  border-top: 1px solid var(--line);
  background: #d0e2ff;
}

.bullet-train-lane::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  pointer-events: none;
  bottom: 16px;
  height: 8px;
  background: rgba(32, 66, 138, 0.45);
}

.bullet-train-wrapper {
  position: absolute;
  --bullet-train-length: 560px;
  left: calc(-1 * var(--bullet-train-length));
  bottom: 16px;
  width: 168px;
  height: 40px;
  transform: none;
  opacity: 0;
  animation: shinkansen-run 12.1s linear infinite;
  animation-delay: 10s;
}

.bullet-train {
  position: relative;
  width: 168px;
  height: 40px;
  border-radius: 20px 14px 12px 20px;
  background: linear-gradient(180deg, #ffffff 0%, #dce9ff 55%, #b7cff8 100%);
  box-shadow:
    inset 0 -3px 0 rgba(30, 69, 153, 0.28),
    0 7px 16px rgba(20, 41, 90, 0.24);
}

.bullet-train::before {
  content: '';
  position: absolute;
  right: -56px;
  top: 0;
  width: 66px;
  height: 40px;
  border-radius: 0 24px 22px 0;
  background: linear-gradient(180deg, #fefefe 0%, #c9ddff 62%, #9fc0f7 100%);
  clip-path: polygon(0 4%, 80% 2%, 100% 50%, 80% 98%, 0 96%, 18% 50%);
}

.bullet-train::after {
  content: '';
  position: absolute;
  left: -13px;
  bottom: 6px;
  width: 15px;
  height: 26px;
  border-radius: 10px;
  background: linear-gradient(180deg, #f7fbff 0%, #c4d9ff 100%);
}

.bullet-train-stripe {
  position: absolute;
  left: 6px;
  right: 4px;
  top: 22px;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, #00afcf 0%, #1f67da 45%, #44d6d9 100%);
}

.bullet-train-windows {
  position: absolute;
  left: 18px;
  top: 9px;
  display: flex;
  gap: 5px;
}

.bullet-train-window {
  width: 10px;
  height: 7px;
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(16, 58, 133, 0.94) 0%, rgba(93, 150, 244, 0.8) 100%);
}

.bullet-train-cars {
  position: absolute;
  inset: 0;
}

.bullet-train-carriage {
  position: absolute;
  left: calc(-62px * var(--car-offset));
  top: 6px;
  width: 60px;
  height: 30px;
  border-radius: 14px 10px 10px 14px;
  background: linear-gradient(180deg, #ffffff 0%, #dfebff 58%, #bfd5fb 100%);
  box-shadow:
    inset 0 -3px 0 rgba(30, 69, 153, 0.24),
    0 2px 4px rgba(18, 44, 102, 0.18);
}

.bullet-train-carriage::before {
  content: '';
  position: absolute;
  left: 8px;
  right: 7px;
  top: 8px;
  height: 7px;
  border-radius: 4px;
  background: repeating-linear-gradient(
    90deg,
    rgba(16, 58, 133, 0.94) 0,
    rgba(16, 58, 133, 0.94) 8px,
    rgba(93, 150, 244, 0.8) 8px,
    rgba(93, 150, 244, 0.8) 10px
  );
}

.bullet-train-carriage::after {
  content: '';
  position: absolute;
  left: 6px;
  right: 4px;
  top: 19px;
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, #00afcf 0%, #1f67da 45%, #44d6d9 100%);
}

@keyframes shinkansen-run {
  0% {
    left: calc(-1 * var(--bullet-train-length));
    opacity: 1;
  }

  26% {
    left: calc(100% + var(--bullet-train-length));
    opacity: 1;
  }

  26.01%,
  100% {
    left: calc(100% + var(--bullet-train-length));
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bullet-train-wrapper {
    animation: none;
    left: 8px;
    opacity: 1;
  }
}

.week-lodging-lane {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  padding: 8px 9px 7px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(199, 249, 224, 0.9) 0%, rgba(229, 255, 242, 0.9) 100%);
}

.week-lodging-span {
  border: 1px solid rgba(13, 148, 136, 0.45);
  border-radius: 999px;
  background: #d4fbe8;
  color: #155a4f;
  font-size: 0.86rem;
  padding: 4px 8px;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.week-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.day-cell {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 9px;
  min-height: 108px;
  min-width: 0;
  overflow: visible;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
}

.day-cell.selected {
  background: var(--select-strong);
  box-shadow: inset 0 0 0 2px var(--select-line);
}

.day-cell.padding {
  background: #eef4ff;
  cursor: default;
}

.day-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  font-size: 1rem;
  font-weight: 600;
}

.day-top > span:first-child {
  flex: 0 0 auto;
}

.day-open-detail {
  display: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  width: 24px;
  height: 24px;
  padding: 0;
  line-height: 1;
  font-size: 0.85rem;
  cursor: pointer;
}

.day-weather {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}

.chips {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.chip {
  display: block;
  min-width: 0;
  max-width: 100%;
  font-size: 0.85rem;
  line-height: 1.25;
  padding: 4px 8px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  white-space: normal;
  overflow: visible;
  overflow-wrap: anywhere;
  text-align: left;
  cursor: pointer;
}

.chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.chip-event {
  background: var(--chip-event);
}
.chip-travel {
  background: var(--chip-travel);
}
.chip-lodging {
  background: var(--chip-lodging);
}
.chip-lodging-handle {
  background: #c9f6ff;
  border-style: dashed;
}

.detail-panel {
  display: flex;
  flex-direction: column;
  padding: 14px 10px;
  min-height: 0;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 10px;
}

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

.close-detail-btn {
  display: none;
}

.detail-header h2 {
  margin: 0;
  font-size: 1.28rem;
}

.detail-title-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.detail-lodging-header {
  margin: 0;
  font-size: 0.92rem;
  color: var(--muted);
}

.detail-empty {
  margin-top: 10px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: #eef2ff;
  padding: 14px;
}

.detail-empty.hidden {
  display: none;
}

.detail-empty p {
  margin: 0 0 10px;
  color: var(--muted);
}

.detail-empty-actions {
  display: flex;
  gap: 8px;
}

.detail-empty-actions button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 8px 10px;
  font-size: 0.92rem;
  cursor: pointer;
}

.timeline {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  border-radius: 10px;
  border: 1px solid var(--line);
  padding-block: 8px;
  background: repeating-linear-gradient(
    to bottom,
    #f4f7ff 0,
    #f4f7ff 14px,
    #e2eaff 15px,
    #e2eaff 15px
  );
}

.timeline-content {
  position: relative;
  --time-gutter-width: 58px;
  padding: 8px 8px 14px;
}

.time-slots {
  position: absolute;
  top: 0;
  left: var(--time-gutter-width);
  right: 0;
  bottom: 0;
  pointer-events: none;
}

.hour-line {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px solid #c2d0f0;
}

.hour-line::before {
  content: attr(data-label);
  position: absolute;
  left: calc(-1 * var(--time-gutter-width));
  top: -8px;
  width: calc(var(--time-gutter-width) - 8px);
  text-align: right;
  font-size: 0.85rem;
  color: var(--muted);
}

.timeline-block {
  position: absolute;
  width: calc((100% - var(--time-gutter-width)) / 2 - 2px);
  border-radius: 10px;
  padding: 8px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  overflow: hidden;
  touch-action: none;
}

.timeline-block.events {
  background: #ffdcb8;
}
.timeline-block.travel {
  background: #d3e6ff;
}

.timeline-block-content {
  font-size: 0.92rem;
  cursor: grab;
}

.timeline-block-content:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.timeline-block-readonly,
.timeline-block-readonly .timeline-block-content {
  cursor: default;
}

.timeline-block.pending {
  opacity: 0.7;
  border-style: dashed;
}

.timeline-block.pending .timeline-block-content::after {
  content: ' Saving...';
  font-size: 0.72rem;
  color: var(--muted);
}

.timeline-content.lane-hover-0 .timeline-block[data-lane='1'],
.timeline-content.lane-hover-1 .timeline-block[data-lane='0'] {
  opacity: 0.45;
}

.quarter-line {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px dashed rgba(66, 100, 196, 0.28);
}

.now-line {
  position: absolute;
  left: var(--time-gutter-width);
  right: 0;
  border-top: 2px solid #ff6a00;
}

.now-line::before {
  content: 'Now';
  position: absolute;
  left: -52px;
  top: -8px;
  width: 44px;
  text-align: right;
  font-size: 0.8rem;
  color: #b54400;
  font-weight: 600;
}

.timeline-block.dragging {
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.2);
  opacity: 0.9;
  z-index: 3;
}

.resize-handle {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 10px;
  background: rgba(0, 0, 0, 0.12);
  cursor: ns-resize;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.segment {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  font-size: 1rem;
  background: #ffffff;
}

.segment.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.item-form {
  --form-control-height: 42px;
  --form-control-padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item-form-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: end;
}

.item-form-row-main,
.item-form-row-side {
  margin: 0;
}

.item-form-row-date-time-duration {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.item-form-row-date-time-duration label {
  margin: 0;
  min-width: 0;
}

.item-form-row-date-time-duration input,
.item-form-row-date-time-duration select {
  width: 100%;
}

.item-form-row-lodging-dates {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.item-form-row-lodging-dates label {
  margin: 0;
  min-width: 0;
}

.item-form-row-lodging-dates input {
  width: 100%;
}

.item-form-row-travel-route {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.item-form-row-travel-route label {
  margin: 0;
  min-width: 0;
}

.item-form-row-travel-route input {
  width: 100%;
}

.item-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.95rem;
}

.item-form input,
.item-form select,
.item-form textarea,
.item-form button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: var(--form-control-padding);
  font-size: 1rem;
  font-family: inherit;
}

.item-form input,
.item-form select,
.item-form button {
  min-height: var(--form-control-height);
}

.field-error {
  margin: -2px 0 4px;
  color: #b42318;
  font-size: 0.87rem;
}

.form-feedback {
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.91rem;
}

.form-feedback.error {
  border: 1px solid #fecaca;
  background: #fff1f2;
  color: #9f1239;
}

.form-feedback.hidden {
  display: none;
}

.app-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.94rem;
  border: 1px solid transparent;
  box-shadow: 0 10px 30px rgba(8, 14, 28, 0.2);
}

.app-toast.hidden {
  display: none;
}

.app-toast.success {
  background: #dcffe9;
  border-color: #66e6a4;
  color: #11633f;
}

.app-toast.error {
  background: #ffe6eb;
  border-color: #ff9db1;
  color: #9a1237;
}

.emoji-picker-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}

.emoji-picker-field label {
  font-size: 0.95rem;
  line-height: 1.25;
}

.item-form-row-title-emoji .item-form-row-main,
.item-form-row-title-emoji .item-form-row-side {
  font-size: 0.95rem;
  line-height: 1.25;
}

.item-form-row-title-emoji .item-form-row-main {
  min-width: 0;
}

.item-form-row-title-emoji .item-form-row-main input,
.item-form-row-title-emoji .item-form-row-side .emoji-picker-trigger {
  box-sizing: border-box;
  height: var(--form-control-height);
  min-height: var(--form-control-height);
}

.emoji-picker-trigger {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  min-height: var(--form-control-height);
  padding: var(--form-control-padding);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.emoji-picker-trigger:hover,
.emoji-picker-trigger:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.emoji-picker-trigger-value {
  font-size: 1rem;
}

.emoji-picker-field-compact .emoji-picker-trigger {
  width: var(--form-control-height);
  min-height: var(--form-control-height);
  padding: var(--form-control-padding);
  justify-content: center;
}

.emoji-picker-field-compact .emoji-picker-trigger-value {
  font-size: 1.5rem;
  line-height: 1;
}

.emoji-picker-field-compact .emoji-picker-trigger-hint {
  display: none;
}

.emoji-picker-trigger-hint {
  color: var(--muted);
  font-size: 0.86rem;
}

.emoji-picker-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 35;
  width: min(340px, calc(100vw - 100px));
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  box-shadow: 0 16px 36px rgba(8, 14, 28, 0.2);
  padding: 10px;
}

.day-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.emoji-picker-popover.hidden {
  display: none;
}

.emoji-picker-library-host {
  display: none;
  min-height: 250px;
}

.emoji-picker-library {
  width: 100%;
  --background: #ffffff;
  --border-size: 1px;
  --border-color: var(--line);
  --button-hover-background: var(--accent-soft);
  --button-active-background: var(--accent-soft);
}

.emoji-picker-has-library .emoji-picker-library-host {
  display: block;
}

.emoji-picker-fallback-title {
  margin: 8.8px 0 6.6px;
  color: var(--muted);
  font-size: 0.86rem;
}

.emoji-picker-has-library .emoji-picker-fallback-title {
  margin-top: 11px;
}

.emoji-picker-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(40px, 1fr));
  gap: 8px;
}

.emoji-picker-option {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  min-height: 40px;
  font-size: 1.1rem;
}

.emoji-picker-option:hover,
.emoji-picker-option:focus-visible,
.emoji-picker-option.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}

.day-items li {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.8rem;
}

@media (max-width: 560px) {
  .app-header {
    padding: 10px 12px;
  }

  .app-title {
    font-size: 1.15rem;
  }

  .copy-ical-btn {
    min-height: 34px;
    padding: 0 10px;
    gap: 6px;
    font-size: 0.8rem;
  }

  .item-form-row {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .item-form-row-date-time-duration {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.item-actions {
  display: flex;
  gap: 4px;
}

.weather-pill {
  font-size: 0.96rem;
  color: var(--muted);
}

.modal-backdrop {
  margin: 0;
  border: 0;
  width: 100vw;
  max-width: none;
  height: 100vh;
  max-height: none;
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: rgba(10, 16, 30, 0.52);
  backdrop-filter: blur(2px);
  opacity: 1;
  transition: opacity 220ms ease;
  z-index: 20;
  padding: 10vh 24px 24px;
}

.modal-backdrop.modal-opening .modal-card {
  animation: item-modal-enter 480ms cubic-bezier(0.16, 1, 0.3, 1) both;
  transform-origin: 50% 12%;
}

.modal-backdrop.modal-closing {
  opacity: 0;
  pointer-events: none;
}

.modal-backdrop.modal-closing .modal-card {
  animation: item-modal-exit 460ms cubic-bezier(0.2, 0, 0.4, 1) both;
}

.modal-backdrop.hidden {
  display: none;
}

@keyframes item-modal-enter {
  0% {
    opacity: 0;
    transform: translateY(26px) scale(0.9);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes item-modal-exit {
  from {
    opacity: 1;
    transform: translateY(0);
  }

  65% {
    opacity: 1;
    transform: translateY(22px);
  }

  to {
    opacity: 0;
    transform: translateY(34px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .modal-backdrop {
    transition: none;
  }

  .modal-backdrop.modal-opening .modal-card,
  .modal-backdrop.modal-closing .modal-card {
    animation: none;
  }

  .modal-backdrop.modal-opening + .modal-close-btn,
  .modal-backdrop.modal-closing + .modal-close-btn {
    animation: none;
  }
}

.detail-modal-scrim {
  display: none;
}

.detail-modal-scrim.open {
  display: block;
  position: fixed;
  inset: 0;
  background: rgba(10, 16, 30, 0.42);
  backdrop-filter: blur(1px);
  z-index: 17;
}

.modal-card {
  position: relative;
  width: min(var(--modal-max-width), 100%);
  max-width: var(--modal-max-width);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border-radius: 14px;
  border: 0;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 60px rgba(8, 14, 28, 0.45);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-card .segmented,
.modal-card .item-form {
  width: 100%;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
}

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

.delete-icon-btn {
  border: 1px solid #fecaca;
  border-radius: 999px;
  background: #fff1f2;
  color: #991b1b;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.delete-icon-btn svg {
  display: block;
  width: 18px;
  height: 18px;
}

.delete-icon-btn:hover {
  background: #ffe4e6;
}

.delete-icon-btn.hidden {
  display: none;
}

.delete-icon-btn:focus-visible {
  outline: 2px solid #dc2626;
  outline-offset: 2px;
}

.close-icon-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.modal-close-btn {
  position: fixed;
  top: 10vh;
  right: max(8px, calc((100vw - min(var(--modal-max-width), calc(100vw - 48px))) / 2 - 48px));
  opacity: 1;
  transform: translateY(-50%);
  z-index: 21;
}

.modal-backdrop.modal-opening + .modal-close-btn {
  pointer-events: none;
  animation: item-modal-close-btn-enter 100ms ease-in-out 220ms both;
}

.modal-backdrop.modal-closing + .modal-close-btn {
  pointer-events: none;
  display: none;
}

.modal-backdrop.hidden + .modal-close-btn {
  display: none;
}

@keyframes item-modal-close-btn-enter {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.submit-icon-btn {
  border: 1px solid rgba(12, 159, 142, 0.45);
  border-radius: 999px;
  background: var(--accent-soft);
  color: #0f5d54;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.submit-icon-btn:hover {
  background: #9ff6e8;
}

.submit-icon-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.submit-icon-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.close-icon-btn:hover {
  background: #e8f1ff;
}

.close-icon-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .detail-panel.mobile-hidden {
    display: none;
  }

  .detail-panel.mobile-modal.modal-open {
    display: flex;
    position: fixed;
    top: 10vh;
    left: 16px;
    right: 16px;
    width: auto;
    max-height: 82vh;
    z-index: 18;
    box-shadow: 0 24px 60px rgba(8, 14, 28, 0.45);
  }

  .detail-panel.mobile-modal .timeline {
    min-height: min(60vh, 560px);
  }

  .detail-panel.mobile-modal .detail-header {
    position: sticky;
    top: 0;
    z-index: 2;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(2px);
  }

  .day-open-detail {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .detail-panel.mobile-modal.modal-open .close-detail-btn {
    display: inline-flex;
  }

  .bullet-train-lane {
    min-height: 74px;
  }

  .bullet-train-wrapper {
    --bullet-train-length: 450px;
    width: 136px;
    height: 34px;
    bottom: 14px;
  }

  .bullet-train {
    width: 136px;
    height: 34px;
  }

  .bullet-train::before {
    right: -44px;
    width: 50px;
    height: 34px;
  }

  .bullet-train-windows {
    left: 14px;
    top: 8px;
    gap: 4px;
  }

  .bullet-train-window {
    width: 8px;
    height: 6px;
  }

  .bullet-train-carriage {
    left: calc(-50px * var(--car-offset));
    width: 50px;
    height: 26px;
    top: 5px;
  }

  .bullet-train-carriage::before {
    left: 7px;
    right: 7px;
    top: 7px;
    height: 6px;
  }

  .bullet-train-carriage::after {
    left: 5px;
    right: 4px;
    top: 16px;
    height: 4px;
  }
}
